Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Peter_QS
Partner - Contributor II
Partner - Contributor II

Set analysis evaluation from string

Hello,

I have set analysis expression stored in my database in string format and I would like to know if there's a way to evaluate this expression :

LOAD
   ID_EXPRESSION
   EXPRESSION
FROM [lib://$(QvdConnection)/Expression.QVD]

LET vExpression_to_evaluate = peek('EXPRESSION') // ex: "Sum({$<BOOL = {'1'}>}SALES)"

in Set Analysis (fx) window : 
=$(vExpression_to_evaluate); // Is this possible ? 


Any idea how to proceed ?

Thanks 

Peter

Labels (1)
2 Solutions

Accepted Solutions
Lisa_P
Employee
Employee

To apply expressions on the front end, you don't need to put them into variables, just use the Dollar sign expansion with an = sign to evaluate the expression

eg. $(=Only({<ID_EXPRESSION={n}>}EXPRESSION))

View solution in original post

JonnyPoole
Employee
Employee

Perhaps its meant to store the expression outside of a single app and re-use it in multiple apps?

If that is the case I think there should be a way.

Does it work if you test a valid set analysis expression without single quotes?  I would test that first. If it does work without single quotes but fails with single quotes, you might need to find a way to properly escape the single quotes by adding a preceding single quote to each single quote

replace($(vExpression_to_evaluate), chr(39), chr(39) & Chr(39)) 

More on this here:

https://community.qlik.com/t5/Design/Escape-sequences/ba-p/1469770

View solution in original post

4 Replies
Lisa_P
Employee
Employee

I'm not sure about what you are trying to achieve here, is it just a matter of storing expressions in a table in the load script and utilizing them in the charts ?

Lisa_P
Employee
Employee

To apply expressions on the front end, you don't need to put them into variables, just use the Dollar sign expansion with an = sign to evaluate the expression

eg. $(=Only({<ID_EXPRESSION={n}>}EXPRESSION))

JonnyPoole
Employee
Employee

Perhaps its meant to store the expression outside of a single app and re-use it in multiple apps?

If that is the case I think there should be a way.

Does it work if you test a valid set analysis expression without single quotes?  I would test that first. If it does work without single quotes but fails with single quotes, you might need to find a way to properly escape the single quotes by adding a preceding single quote to each single quote

replace($(vExpression_to_evaluate), chr(39), chr(39) & Chr(39)) 

More on this here:

https://community.qlik.com/t5/Design/Escape-sequences/ba-p/1469770

Peter_QS
Partner - Contributor II
Partner - Contributor II
Author

Thank you all for your answers