Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to use variable in set expression ?

Hi,

I have a doubt which seems very basic but I am unable to find the solution.

I have a field named 'Product' with values 'CITY', 'Civic', 'Jazz' etc

If I set the expression,

Sum({<Product={'CITY'}>}sum) ... I get the CITY specific chart. But I want to make the chart dynamic based on the 'Product' selection made by the user....

So I have set a variable named 'ProVar' which will have its correspoding 'Product' value assigned as user selects from a product list box.

I need to edit the expression so that it will take the ProVar and change Dynamicaly.

When I modify the expression like this Sum({<Product={ProVar}>}sum) its not working.

I know that it shud be a simple issue.. but it'll be of great help if you can just let me know the correct syntax  for framing in the set expression in this case.

8 Replies
Not applicable
Author

sum({<Product=${ProVar}>})

use this may it helps u.

Regards,

Chandra

Not applicable
Author

I tried using Sum({<Product={'$ProVar'}>} sum) .. but still this is not working..

Not applicable
Author

Hi,

sum({<Product=${ProVar}>})

use this may it helps u.

Regards,

Chandra

perumal_41
Partner - Specialist II
Partner - Specialist II

Sum({<Product={$(ProVar)}>}sum).please try this

Not applicable
Author

Hi,

sum({<Product=$(ProVar)>})

hey sorry for the previous post , i for got to use braces

Regards,

Chandra

brenner_martina
Partner - Specialist II
Partner - Specialist II

Hi,

you have to enter:

Sum({<Product={$(=Only(Product))}>} Fieldname)

or if you want to use a variable, define one at Settings:

varProduct =Product

Sum({<Product={$(varProduct)}>} Fieldname)

pat_agen
Specialist
Specialist

hi,

it will be easier to help if you post the definition of your variable ProVar. Depending how this is set will shwo you hwo the varaible shoudl be dealt with.

For a start $ expansion requires that the varaibel to be expanded is found inside the brackets like this $(ProVar).

However thsi may react differently depending on what ProVar contains.

start by replacing

     Sum({<Product={'$ProVar'}>} sum)

with

     Sum(  { <Product= {$(ProVar)}>} sum)

see what happens. If no luck post teh definition of your variable

Not applicable
Author

This worked fine for me 

Sum({<'$ProVar'>} sum)

Thanks a lot for your replies