Multi-select Option filter on a table - display in chart title when activated

  • 1
  • Question
  • Updated 8 months ago
  • Answered
Hi,

I have a table with a multi-select option filter, there is a chart linked to the table which dynamically updates when the filter is activated.

I have been asked if we can display the values selected in the multi-select option filter in a chart title. Has anyone tried doing this?

Thanks

Damien

Photo of Damien Murray

Damien Murray

  • 474 Points 250 badge 2x thumb

Posted 8 months ago

  • 1
Photo of Bill McCullough

Bill McCullough, Champion

  • 12,436 Points 10k badge 2x thumb
Damien,

Here is a snippet that demonstrates how to add to the chart title.  Create the snippet and set it to run before rendering the chart (click on the chart, find the Advanced tab in the properties area, and select the snippet in the Before Render Snippet option).  You will need to adjust the model and the name of the condition.

Thanks,

Bill

var params = arguments[0],
$ = skuid.$;
var model=skuid.model.map().Opportunity;
console.log('model');
console.log(model);
var con=model.getConditionByName('__autofilter__StageName');
console.log(con);
var val = con.values;
console.log(val);
if (val !==undefined) {
    var display ='';
    for (var i=0; i < val.length; i++) {
        display += val[i];
        if(i!==(val.length -1)) {
            display += ', ';
        }
}
console.log('display');
console.log(display);
params.title.text = params.title.text + ': ' + display;
    
}
Photo of Damien Murray

Damien Murray

  • 474 Points 250 badge 2x thumb
Thanks Bill, that works perfectly!

Have you tried this with multiple picklists? 

Thanks 

Damien
Photo of Bill McCullough

Bill McCullough, Champion

  • 12,436 Points 10k badge 2x thumb
Damien,

It does work with multi-select filters.  I am not sure about multi-select pick list fields.

Thanks,

Bill
Photo of Damien Murray

Damien Murray

  • 474 Points 250 badge 2x thumb
Thanks Bill, really appreciate your help.

Thanks 

Damien
(Edited)