Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Variable in Set Analysis for text replacement

hello All,

I have lot of expressions in my document which have similar pattern in the set analysis, although the measures differ.

='$'&NUM(ROUND(SUM({<name={'Baby Products'}>}sales)),'##,###,###,###')

this and similar expressions where the 'Baby Products' changes as needed.

Question 1: Is there a way I can put the whole expression in variable for reusability and pass the  'Baby Products' or other value as parameter?

Question 2: I tried putting atleast the "name={'Baby Products'}" in a variable and called vSetFilter and use the expression '$'&NUM(ROUND(SUM({<$(=vSetFilter)>}sales)),'##,###,###,###') but it does not work.

Thanks

Raghu

8 Replies
Not applicable
Author

Attached is a sample QVW incase you need it.

Thanks

Raghu

Not applicable
Author

Hi,

you can try with:

='$'&NUM(ROUND(SUM({<name={$(vSetFilter)}>}sales)),'##,###,###,###')

where

vSetFilter = 'Baby Products'

Hope it helps

regards

Giampiero

Not applicable
Author

Hi Giampiero,

That does not solve the problem of reusability much. I am just replacing 'Baby Products' with $(vSetFilter).

What I wish to do it to make the whole expression as a variable, and then maybe pass another variable like vSetFilter = 'Baby Products' or vSetFilter="name={'Baby Products'}" as a parameter.

Not sure if I am able to explain correctly, but let me know if you have more questions please

Thanks

Raghu

Not applicable
Author

Hi Raghu,

I understand your problem.

Just a question, how do you want to change the var. value?

Do you want to use an input box or other?

I try to think about your problem.

Regards

Giampiero

Not applicable
Author

Hi Giampiero,

The way I want to use this is:

Whenver I need an expression, I can use the expression variable and then pass on or concatenate the setFilter variable into the overall expression to get the correct filtering of my data.

Thanks

raghu

chematos
Specialist II
Specialist II

Have you tried using quotes??

'$'&NUM(ROUND(SUM({<'$(=vSetFilter)'>}sales)),'##,###,###,###')

'$'&NUM(ROUND(SUM({<"$(=vSetFilter)">}sales)),'##,###,###,###')

Not applicable
Author

This does not work. Incorrect Syntax error.

You can try it in the test QVW I attached above.

Thanks

Raghu

Not applicable
Author

Hi Raghu,

see attach file.

See the variables.

Hope it helps

Regards

Giampiero