cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAC - how to filter Table through checkboxes (multi-selections) in New Model

miss_who
Explorer
0 Likes
2,858

Hi experts,

Following the "Best Practice: Filter Table and Chart Through Checkboxes (Multi-Selections)" in Help Portal, I successfully filtered Chart through multi-selections checkboxes in New Model, but it didn't work in Table.

I guess it may be due to the error in the “setMeasureFilter” script - The sample may be based on a classic model created because the first line of its script is to filter for Accounts (with data such as Discount/quantity, which are the Measures in new model).

I have tried 2 methods to solve this problem:

1) Change the first line to "Product" dimension or "Measures";

2) Change the Chart_1 into Table_1 'Chart_1. removeMeasure (CurrentMeasureFilterSelection [i], Feed. ValueAxis);', but the system displays [Table_ 1. has no removeMeasure function].

But they all failed.

How to write the scripts for checkboxes (multi-selections) to filter Table in New Model?

Accepted Solutions (1)

Accepted Solutions (1)

N1kh1l
Active Contributor
0 Likes

miss_who

see the below example of a measure based model. I have put the below script on the Refresh Button. It basically refreshes the table with the measure selected in the Measure lists.

var sel_measure = Measure_List.getSelectedKeys();

console.log(sel_measure);

var DS=Table_1.getDataSource();
DS.removeDimensionFilter(Alias.MeasureDimension);
DS.setDimensionFilter(Alias.MeasureDimension,sel_measure);

Hope this helps !!

Please upvote/accept if this helps.

Nikhil

miss_who
Explorer
0 Likes

Thanks a lot! Nikhil!

Could you please show me more detail about function? Which function did you put these scripts?

Best regards,

Doris

N1kh1l
Active Contributor
0 Likes

miss_who

I had put the code on on Click event of the Refresh Button I am using.

I think for you it will go it Set selected button click event

Nikhil

miss_who
Explorer
0 Likes

What's the meanning of the "Measure_List" in your code?

Is "Measure_List" a new dimension which collect your measures?

N1kh1l
Active Contributor
0 Likes

miss_who

"Measure_List" is just the name of my checkbox group. I just renamed it to meaningful name.

Nikhil

miss_who
Explorer
0 Likes

Could you please show me the data action setting?

N1kh1l
Active Contributor
0 Likes

miss_who

Data Action is not relevant to the topic. It shows up in my list of objects as I used an existing stories which has data Action trigger button to execute some data Actions. It has no role in what we are discussing here. If you want to see my measure list its below

Nikhil

Answers (2)

Answers (2)

sourabhpaul
Participant
0 Likes

Hi,

First you have to use removedimensionfilter(). then you have to use setdimensionfilter().

Regards,

Sourabh Paul

N1kh1l
Active Contributor
0 Likes

miss_who

Try using the below

setDimensionFilter(dimension: string | DimensionInfo, member: string | string[] | MemberInfo JSON | MemberInfo[] JSON | MeasureInfo | MeasureInfo[] | TimeRange | TimeRange[] | FilterValue JSON | RangeFilterValue[] JSON): void
Sets a filter on the dimension.

Hope it helps

Nikhil

miss_who
Explorer
0 Likes

But I want to filter measures in my table, is there any other function can be applied in New Model to filter measure?

Thank you!

Best regards,

Doris

N1kh1l
Active Contributor
0 Likes

miss_who

The API takes Measures also as parameters. There is no explicit Measure related API.

Nikhil