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

Issue Setting Multiple Intervals for Variable using setVariableValue via Scripted Button in SAC?

Feras
Explorer
0 Likes
970

Hello everyone,

I'm currently working on a scripted button in SAP Analytics Cloud (SAC) to dynamically set values for a variable using the setVariableValue() method. While this works perfectly for a single interval, I’m encountering issues when trying to set multiple intervals at once.

For example, I’d like to set the variable to include the following ranges:

  • 1000–1999

  • 3000–3999

  • 6000–6999

However, when I execute the following script, only the last interval (6000–6999) is applied.:


Chart_1.getDataSource().setVariableValue("HRHN_SAC", {
from: "1000",
to: "1999",
from: "3000",
to: "3999",
from: "6000",
to: "6999",
exclude: false
});

It seems that SAC is overwriting the previous values and retaining only the final one.

Am I missing something here? Is there an alternative approach to pass multiple intervals to a variable in a single script?

Any guidance would be greatly appreciated.

Best Regards,
Feras

Accepted Solutions (1)

Accepted Solutions (1)

Susanne_Helbig
Product and Topic Expert
Product and Topic Expert

Dear @Feras,

I'm not an expert in this area, but you might want to try something like below: 

Chart_1.getDataSource().setVariableValue("HRHN_SAC", [
{from: "1000",to: "1999",exclude: false},
{from: "3000",to: "3999",exclude: false},
{from: "6000",to: "6999",exclude: false}
]);

Maybe this helps

Best regards
Susanne

Feras
Explorer
Thank you very much! it worked 🙂

Answers (0)