Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
ArjunPrasad
Contributor III
Contributor III

Creating expression using variable in script

Hi All,

I am trying to create one expression in script using Let or Set variable but not getting expected output.

i a have a master calendar Year field 

Set vSales = 'Sum({<Year={"$(=Max(Year))"}>}SalesAmount)';

Above expression not working, applied in table expression like : $(vSales)

Set vSales = 'Sum({<Year={1998}>}SalesAmount)';  // This is working

not able figured it out , please suggest me.

Thanks

Arjun

1 Solution

Accepted Solutions
tresesco
MVP
MVP

One way could be using LET, like:

Let vSales = 'Sum({<Year={'&'"$'&'(=Max(Year))"}>}SalesAmount)';

View solution in original post

4 Replies
tresesco
MVP
MVP

One way could be using LET, like:

Let vSales = 'Sum({<Year={'&'"$'&'(=Max(Year))"}>}SalesAmount)';

ArjunPrasad
Contributor III
Contributor III
Author

Thank u Tresesco its working now.😊

but why we using like  { '&'"$'&'(=Max(Year))"}

cant we use like this {"$(=Max(Year))"}  //its not giving any value either.

Can you please let me know.

Thanks,

Arjun

tresesco
MVP
MVP

Short answer, '$' gets evaluated in the script as well. Therefore, you have to suggest qlik engine that '$' for this case is not for expansion but treat it as a string/char.

ArjunPrasad
Contributor III
Contributor III
Author

Thank u for clarification @tresesco .