cancel
Showing results for 
Search instead for 
Did you mean: 

Restricted measure via sac script

thayumanavan
Participant
0 Kudos

Hi Folks,

Is there any way to add the created restricted measure on the column of the table using sac script on click action using dropdown values

Regards,
Thayu.

View Entire Topic
N1kh1l
Active Contributor

thayumanavan

thayumanavanAgain not sure of the use case. But you would need the ID of the restricted measures you created in the story and its not the name what you provide in calculation editor. You can get all the measures by below API

var sel =Table_4.getDataSource().getMeasures();
console.log(sel);

In my example I have created a restricted measure called "RM1", the id is shown as below.

Alternatively you can also find the id from Measure selector and switching the display to ID

To add the restricted measure to the column just use the below API. Make sure you have measures in column in initial table definition

Table_4.getDataSource().removeDimensionFilter(Alias.MeasureDimension);
Table_4.getDataSource().setDimensionFilter(Alias.MeasureDimension,"15076535-0910-4753-3381-832678712003");

Initial Table:

After button lick with the above API

You can use the same API on dropdown selection or any other Trigger.

Hope this helps

Br.

Nikhil

thayumanavan
Participant
0 Kudos

Hi @Nikhil Anand,

Thanks a lot. Its worked for me.

Regards,
Thayu.