Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
onkellepie
Partner - Contributor III
Partner - Contributor III

QlikSense: Change Variable inside SetAnalysis

Hi,

i use qlik sense November Relase, use Mashups and the JS API.

I create a qvf with two variables:

LET var_Currency = 'EUR';

LET varSum_Amount = 'Sum({$<Currency={"$(varCurrency)"}}>} Amount)';

Now i create a Textfield:

Fx:

='var_Currency:' & var_Currency & CHR(13) &

'varSum_Amount:' & varSum_Amount & ':' & $(varSum_Amount) & CHR(13)

The Amount will be calculated for EUR.

BUT:

When i changed the value of "var_Currency" to "GBP" with Engine API Explorer or JS API the value of Variable "varSum_Amount" does not changed. The value of var_Currency changes to GBP.

Did anyone know how to solve this?

Thanks for any help!

Regards

1 Solution

Accepted Solutions
ali_hijazi
Partner - Master II
Partner - Master II

you mean you need to use parameterized variables?

then you might use something like this:

set varSum_amount = sum({<currency={$1}>} Amount);

on the chart you reference it as $(varSum_amount('EUR'))

I can walk on water when it freezes

View solution in original post

6 Replies
Anil_Babu_Samineni

May be GBP is not the correct Word. This should be case sensitive

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
ali_hijazi
Partner - Master II
Partner - Master II

you mean you need to use parameterized variables?

then you might use something like this:

set varSum_amount = sum({<currency={$1}>} Amount);

on the chart you reference it as $(varSum_amount('EUR'))

I can walk on water when it freezes
Miguel_Angel_Baeyens

In the varSum_Amount expression, the variable is referred to without underscore, but in the LET definition it does use an underscore. Is it a typo or could be the issue?

onkellepie
Partner - Contributor III
Partner - Contributor III
Author

Hi, no. GBP is the correct spelling.

onkellepie
Partner - Contributor III
Partner - Contributor III
Author

Thats a typo. sry. no that is not the problem

onkellepie
Partner - Contributor III
Partner - Contributor III
Author

Hi,

you are me hero! Thank you very much. This works!

i dont know that parameterized variables are possible until now. Nice feature!

I solved it like this:

Skript:

LET var_Currency_param = 'EUR';

LET varSum_Amount_param = 'Sum({$<Currency={$1}>} AmountAuth)';

Textbox:

& '****PARAM***'  & CHR(13)

& 'var_Currency_param:' & var_Currency_param & CHR(13)

& 'varSum_Amount_param: ' & varSum_Amount_param & ':' & $(varSum_Amount_param($(var_Currency_param))) & CHR(13)

When i changed the variable "var_Currency_param" with Enigne API Explorer the value will be recalculated.

Thank you.

Best Regards