Using table mass action as a multi-pick filter

  • 1
  • Question
  • Updated 3 years ago
  • Answered
I have an aggregate model that averages scores for various questions, and then sorts in ascending order. 

The intent is that the "bad" scores will float to the top, and the user will display the resulting chart to our customer as part of a "Let's work on these items" discussion.

But sometimes - just to make life difficult - the user doesn't want the EXACT "Worst 10" per the score averages; sometimes he wants to filter down based on discussions he's already had with the customer, or exclude questions that haven't appeared on enough audits to give a good average, etc.

So I created a table, and originally created a table filter so they can pick the questions they want.  However, that filter list is in the same order as the original field (i.e. alphabetical).  Now, in order to pick, say the 1st, 3rd, 4th, 7th and 9th question, the user will have to search for them alphabetically.

I'm hoping there's a way to, instead, check the boxes next to the desired questions and start a mass action, which would then filter based on those selections and change the related chart.



I have an off-by-default filter set on the model's "Question" field.  I tried to have the Mass Action update this using the alias name of the grouping for Question.  But every time I run the Mass Action, the table blanks out.  

Not sure if this is because it's just not possible - setting a condition with multiple selections this way...Or if it's because I'm using the wrong syntax for an aggregate.  I'm hoping it's the l
Photo of Monica Lorey

Monica Lorey

  • 384 Points 250 badge 2x thumb

Posted 3 years ago

  • 1
Photo of Anna Wiersema

Anna Wiersema

  • 10,890 Points 10k badge 2x thumb
This is such a cool use case Monica! It sounds like you are on the right track to do this declaratively.

some thoughts:
  • Is your Questions filter set to Single Specified Value?  Maybe it will work if you choose Multiple Specified Values instead.
  • So after you have the mass action activate & set the value of this model condition, you have another action querying the model, right?

I'm going to try to replicate something like this and see if I can figure out how to do it/if it's possible...


Also the super easy fix would be to go into Salesforce Setup and change the way the values for the Question field are ordered, so it's by number and not by alphabetical order ;) But maybe on other pages you would still prefer the values to be listed alphabetically.
Photo of Monica Lorey

Monica Lorey

  • 384 Points 250 badge 2x thumb
Ahh!  I thought the Multi-Specified would totally do the trick (since I hadn't set it that way originally).

That's still zero-ing things out, though. :(

(And yes, the mass action is setting the condition and querying the model.)

And unfortunately the number is the aggregate result - an average of the scores of all the questions, so there's nothing for me to sort by in Salesforce.

Please let me know if you can replicate it...or if you want to jump in our org, that's fine too!  If I can pull this off, I'll be a superhero for sure, since this will kill this problem...and another the users have complained about because I'll be able to use the same concept to set conditions on a parallel model, so the user doesn't have to pick from two different tables!
Photo of Anna Wiersema

Anna Wiersema

  • 10,890 Points 10k badge 2x thumb
Okay, I am also a little stuck on this.  But working on it did remind me that with charts when you are showing the legend you can click on a source to hide it from the chart. This could be another way to limit which questions show in the chart.
Photo of Monica Lorey

Monica Lorey

  • 384 Points 250 badge 2x thumb
To further complicate matters...

There are a little over 100 questions for these audits.  I originally wanted to limit the model to 10, but I got feedback that that would be enough - because if they exclude 4 of the questions for various reasons, that only leaves them with 6 (and they'd still want 10 total, or maybe 11, or whatever their pretty heart desires).

So I've had to set the model to no limit...
And that's why I'm using the table and filters to let them pick and choose.

This certainly presents a problem with the initial chart, too, because it will often pack in as many questions as it can, but not have room for all the labels in the axis.  So you'll see a total of 30 bars, but only 15 labels.

If I can force them to come to some kind of agreement - say, limit it to 25 - then they would all fit, and they could then click the questions...but that doesn't actually remove it from the graph, just grays it out.  Do I need to reverse my axes in some way?  

Photo of Anna Wiersema

Anna Wiersema

  • 10,890 Points 10k badge 2x thumb
Hmm. As far as the chart goes, it looks like you're using Question as your category axis?  Another way you could do it is is use a template, aka "Question" for the Category axis and then in Series do average score and split by Question there. That allows you to have a different color for each question bar and then, when you click on a question in the legend, it totally removes it from the chart. (see below, same idea but column type chart on the opportunity object, average amount split by Stage)
Photo of Monica Lorey

Monica Lorey

  • 384 Points 250 badge 2x thumb
I tried that..I think there are just TOO many questions for that to really work for us (that bottom legend starts to look like a mess).  And since they're looking to give these charts to customers, I think they want to fully remove certain questions (not have them grayed out).

I'm getting closer, though...maybe.

The second chart that I want to be able to show compares "baseline" audits the rep did versus the results of "followup" audits.  I have 2 separate models for this (and thought maybe that would help with using mass actions to set conditions).  

At this point, I'm half-successful using the mass action magic to use the list of Baseline questions (left table) to set the Followup questions (right table).

Except...it only does the first one.  :(  I have the condition on the Followup set to multiple values, but still can't quite get it there.



I swear this is possible somehow (I have faith!)...If anyone has a eureka moment, please let me know!
Photo of Monica Lorey

Monica Lorey

  • 384 Points 250 badge 2x thumb
After some more community scouring, I realized this post did what I needed!
https://community.skuidify.com/skuid/topics/filter_based_on_distinct_or_aggregate_query?topic-reply-...

So I'm still using a table filter, but now it's based on the aggregate model, so it's filtered in the ascending order of the "average score" that's calculated inside the model.



Shout out to Zach McElrath...2 years ago!
Photo of Anna Wiersema

Anna Wiersema

  • 10,890 Points 10k badge 2x thumb
Monica, I'm so glad you found an answer! We owe so much to that guy, both to his two years self and his present one.
(Edited)