cancel
Showing results for 
Search instead for 
Did you mean: 

SAC scripting: Change measure based on value of a dimension input control?

0 Kudos

Hello,

I have a dimension input control like this:

alexander_john_berlin_0-1715091103241.png

I want to change the dimension of another chart based on the selected dimension in that dimension input control.

For example of "Hersteller" is selected there, I want the dimension of a bar chart to be "Serie". Etc.

Is that generally possible in the SAC?

Accepted Solutions (0)

Answers (1)

Answers (1)

david3030
Explorer

Hello,

 

Maybe you can achieve that with a little script like that :

Based on Story Filter for this example.

 

var j_harmony = {"KeyOfDimensionElem1":"keyOfMeasuretoShow1",
"key_OfDimensionElem2":"keyOfMeasuretoShow2"};
 
var filter2Use = Application.getFileDataSource("fndTheIdWithTheSelektor").getDimensionFilters("TheDimWhichIsFiltered")[0];
var filterValue = cast(Type.SingleFilterValue,filter2Use);
 
Chart_1.getDataSource().setDimensionFilter(Alias.MeasureDimension,j_harmony[filterValue]);
 
KeyofDimensionElem1 ist for example the key of Hersteller and the keyOfMeaseurtoShow is the UID of Measure you want to show "connected" with the Hesteller.
 
I hope it helps,. After that you have to decide when you want to start this function... it could be funny ^^ you can first of all build the script based on a button and after that you can study where you start the function maybe onResultChange of your table.... beware of endless loops. 
0 Kudos
Hello, thanks for the reply. I will try to implement it. Is it true, that the onSelect() event does not work for dimension input control?
david3030
Explorer
0 Kudos

The onSelect() event should work (QRC2/2023). You are right, for dimension input control it doesn't work. Use the the onResultChange on your table/chart. If enlessloop, use a variable to bypass the refresh. something like that

david3030_0-1715159088230.png