on ‎2026 Apr 23 1:13 PM
Hello everyone,
for my story I implemented a dynamic measure change via a switch for three of my charts. One of them is as standard equipped with a top n filter. However, when i flip the switch and the new measures are shown the filter is being removed.
Do you know if there is a function to enable the filter again afterwards?
Thank you all in advance!
var measuresStandard2 = ["", "", "", ""];
var measuresAlternative2 = ["", "", "", ""];
var measuresStandard3 = [""];
var measuresAlternative3 = [""];
var isSwitchOn = this.isOn();
if (isSwitchOn) {
// Chart 1
for (var i = 0; i < measuresStandard1.length; i++) { Chart_1.removeMeasure(measuresStandard1[i], Feed.ValueAxis); }
for (var j = 0; j < measuresAlternative1.length; j++) { Chart_1.addMeasure(measuresAlternative1[j], Feed.ValueAxis); }
// Chart 2
for (var k = 0; k < measuresStandard2.length; k++) { Chart_2.removeMeasure(measuresStandard2[k], Feed.ValueAxis); }
for (var l = 0; l < measuresAlternative2.length; l++) { Chart_2.addMeasure(measuresAlternative2[l], Feed.ValueAxis); }
// Chart 3
for (var m3 = 0; m3 < measuresStandard3.length; m3++) { Chart_3.removeMeasure(measuresStandard3[m3], Feed.ValueAxis); }
for (var n3 = 0; n3 < measuresAlternative3.length; n3++) { Chart_3.addMeasure(measuresAlternative3[n3], Feed.ValueAxis); }
} else {
// Chart 1
for (var m = 0; m < measuresAlternative1.length; m++) { Chart_1.removeMeasure(measuresAlternative1[m], Feed.ValueAxis); }
for (var n = 0; n < measuresStandard1.length; n++) { Chart_1.addMeasure(measuresStandard1[n], Feed.ValueAxis); }
// Chart 2
for (var o = 0; o < measuresAlternative2.length; o++) { Chart_2.removeMeasure(measuresAlternative2[o], Feed.ValueAxis); }
for (var p = 0; p < measuresStandard2.length; p++) { Chart_2.addMeasure(measuresStandard2[p], Feed.ValueAxis); }
// Chart 3
for (var o3 = 0; o3 < measuresAlternative3.length; o3++) { Chart_3.removeMeasure(measuresAlternative3[o3], Feed.ValueAxis); }
for (var p3 = 0; p3 < measuresStandard3.length; p3++) { Chart_3.addMeasure(measuresStandard3[p3], Feed.ValueAxis); }
}
Request clarification before answering.
You could try the rankBY API. Just type Chart_1.rankBy({}); Inside the curly braces press Ctrl Space and it will allow to populate options as below.
https://help.sap.com/doc/1639cb9ccaa54b2592224df577abe822/release/en-US/index.html#Chart_MrankBy
//Top 5
Chart_1.rankBy({rankOrder:RankOrder.Top,structureMember:"[Account_BestRunJ_sold].[parentId].&[Gross_Margin]",value:5});
Hope this helps !
Nikhil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 8 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.