Generate list of events by day

Options
I’d like to convert an list of events to a list of dates that contain the events happening that day. I’m not sure the best method..

[
{Event 1, Date 1},
{Event 2, Date 1},
{Event 3, Date 2}
 ]

to

[
{Date 1: [ {Event 1}, {Event 2} ] }, 
{Date 2: [ {Event 3} ]}
]

Thank you!

Comments

  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
    Hi  - I would consider using an aggregate return type on your Query All Records (Query All Records > Output > Return > Aggregate). This would allow you to Group by the different day and use an aggregator of to_list for Events
  • Jack Waterman
    Options
    Thanks for the reply! I am having a few problems doing what you suggest:

    First, it seems like start_date and end_date are not available to group by. Do I need to use timestamp or convert start date to plain text in anther column?
    [image.png][image.png]
    To test the process, I grouped by org id and aggregated to_list by event id. Is there a recommended way to bring in more than the event id? I would like to have all the same information (name, org, desc, img, etc) in that position.[image.png]
  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
     hmm Date is new field type so it looks like it didn't get added to the Group By - we'll go ahead and add this in, probably in the next build

    Addons are used to pull data from related tables so you can decorate table references with the data in the table they relate to
  • Jack Waterman
    Options
    Awesome thank you for looking into that.

    For the addons, I am not sure if this works as proposed with the aggregate result. How do I force the addon to occur after each event_id in the aggregated to_list?
    [image.png]It seems like the addon occurs below the aggregated list.[image.png]Thank you!
  • Chris Coleman
    Chris Coleman Administrator

    ADMIN

    Options
     Hey, Jack! We've just rolled out support for this. Thanks for your patience!
  • Jack Waterman
    Options
     and , thank you for updating the aggregate to include dates. I am still having trouble accessing the event info after aggregating.
    [image.png][image.png][image.png]
    I tried an addon (_event_by_date) that takes event_id, but can that be applied to the even_id array above?

    Maybe I need another approach like an extra step in the api, or it may be possible in the frontend by comparing the id array for each day to another list of all events in the date range

    Let me know if I should join the office hour, thank you!