Aggregate Event counts per User by next N days out

  • 1
  • Question
  • Updated 3 years ago
  • Answered
We are having a use case that I thought we could figure out but have not yet. We are trying to build a Table with a Row Per User that has Events scheduled, The part that is hard is that the Columns need to be count of Events by days out from Today (See Attached Screenshot Mockup). Basically have a column for Today, Tomorrow, The next day and so on for 10 Days with a Count of how many Scheduled Events are there in a Table Format. 

Does anyone have any Ideas or Guidance to how they would approach this with Skuid?

Photo of Jarrod Hinson

Jarrod Hinson

  • 2,310 Points 2k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Not sure if there's an easy way, but here are two hard ways:

1. Create separate models for each of your date conditions, and then use templates to show the values and panel sets to format them like a table.
2. Use one model, and put your events aggregation on a table 12 times (or however many columns you want). Then run a different custom field editor on each column to limit the values to the date range you want for that column with javascript.


I'm really hoping there's a better way....
Photo of Jarrod Hinson

Jarrod Hinson

  • 2,310 Points 2k badge 2x thumb
wow... thats painful. I am thinking this is going to be a ton of Javascript :(
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
The other painful way is to create separate models for each date condition and then use custom renderers on a primary model that grep the additional models and post the correct values for the correct person.  

But hint hint...  I think there will be a feature in Banzai that will let you do some of this declaratively.  Check back in a few weeks when its out and open and I can describe. 
Photo of Jarrod Hinson

Jarrod Hinson

  • 2,310 Points 2k badge 2x thumb
That sounds like you guys are heading in the right direction. I am underway with the process you describe above, seems like its going to work. I am going to have to set a condition on page load to the models for date and then the field render-er will go loop the models and find the matching User aggregate to get the count.

Is there a way to Grep a Model in the API to get the single row, or should I just loop the models and check field values until i get a hit?