Skuid Pages for Dashboards/Data Visualization & analytics (Master filter for all tables/charts)

  • 1
  • Question
  • Updated 4 years ago
  • Answered
We are trying to leverage Skuid pages for dashboards/reports/data visualization:

1) We would like to know exciting ideas/working examples on this topic.

2) We have a Skuid page with different types of charts, tables etc each driven by different skuid models (but from same SF object as of now). I would like to have a filters at the top of page which are applicable for all the components on page. Please let me know a better way of doing this.

3) Here is what we have done so far. We have a table with model (We call it as a master model) where we have added filters. Currently, we are trying with multi-select filter. We have other tables/charts with different models.
One of the condition on each of these models is: Name is in the set of Name values returned by Master Model. The condition source is 'Field from another Model' and is set as 'Filterable default off'. I am re-querying these models when the filter is applied on the master table. This is configured in action framework. When master model is queried, I am activating above 'Name' condition and then querying other models. However this does not work. When I checked in console, I noticed that the condition does not refresh with the new Name values from master model. It works when I refresh page though. Also, I cannot leverage 'Activate and set value of condition' in action framework as there isn't option to set condition values (multiple values) from another model.
Currently, I have workaround for this. I created 'filterable default off' condition on the other models for the field which is used in filter (multi-select filter which I am referring above) on master table.  I coded snippet where I access system generated condition associated with the filter and thus it's selected values and pass those values to the conditions on other models and activate them. I call this snippet from action framework every time master model is queried. I don't use 'Name' condition. This works great. However the issue is this solution might not be scalable and had to add code for all the filters and all the models. Please let me know how I can make use of 'Name' condition.
Photo of TJ

TJ

  • 952 Points 500 badge 2x thumb

Posted 4 years ago

  • 1
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Your idea of having a master list, and then forcing requeries on the children lists by comparing them to the Names in the master list is pretty innovative, but I think it will be problematic.   Skuid does not automatically re-set the values in "Field from another model" conditions when you requery those models. You have to reset the values of the conditions,  which will be difficult in this case. 

We have been able to use what we call "Arbitrary filters"   where a field editor control updates data in a "filter model".   When those fields are updated - values are passed to conditions in one or more models and these models are requeried. 

Here is a link some XML where this is shown for one model.  But using the action framework you can extend this to multiple models. 

https://github.com/skuidify/SamplePages/blob/master/ActionRecipies/Arbitrary_Filter.xml
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Another page that Zach had built might be helpful.  Again it only filters one model right now - but because it is using the action framework,  there is no reason it can't filter multple models and thereby control multiple charts and tables. 

https://github.com/skuidify/SamplePages/blob/master/ActionRecipies/FieldEditorFilters.xml

Enjoy. 
Photo of TJ

TJ

  • 952 Points 500 badge 2x thumb
Thanks Rob! I will look into these posts. Meanwhile, I read somewhere on community that if I update all the models (child and master where filter is present) in single call like below; it resets the conditions too.
skuid.model.updateData([aModel, bModel, cModel]);

I checked & it actually works. However, if I call this code from action framework and on 'requery of master model' event; all the charts and tables with child models keeps on refreshing as the code execution goes into infinite mode. So, my question is there any other event where I can call this script when the filter is changed? I mean- I need to know filter change event and the corresponding arguments.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
DJT; 

I'm not going to reccomend that you pursue the direction you are suggesting.  While it might be feasible,  it will require some custom code, and be more complicated than an alternative declarative solution. 

Here is that simpler solution (as propotyped in the xml files above)

1. Rather than using table filters to control the master,  use field editors on a single record in a "master model".  The field editors probably should be in edit mode and can be placed anywhere on the page.  

2. Create actions on that model that listen to changes in the fields in your field editor. 

3. When changes are detected,  update conditions in your children models with the value selected in the field editor.  Then requery the children models. 

Zach's page is a good model for this. 

Hopefully this doesn't require too much reconstruction on your part.  But its the better way. 
Photo of TJ

TJ

  • 952 Points 500 badge 2x thumb
Rob,
Thank you for your support. I incorporated Zach's idea in my page and it looks good. It works on multiple models. However, the filters on field editor- which are just fields - are not as powerful as actual Skuid table filters. For example, I cannot have multiselect option filter for picklist field. I might try custom snippet for this though.
But for now, this solution looks good. I will provide more updates on this to J. Tingle with whom we have weekly meetings scheduled.
Thanks again!
(Edited)