Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

store expression into variable

hi i have a scenario in this i need to store expression into variable but the expression gives to values in that i want only one value

plzz help me

this is the expression

=not WildMatch(F_Quarter,'*Q1')

it is displaying 2 values 0 and -1 i want to store this expression into variable

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

Are you planning to use this in a chart or table? If yes, make sure that it is stored without the leading = sign. Ariel Klein's suggestion is correct, except that you need to escape the single quotes like this:


Set vVar = 'not WildMatch(F_Quarter,''*Q1'')';


Use the expression in a $ expansion. Provide more details about your use of the variable for more specific help.

If you are planning to use this in a context where F_Quarter has more than one possible value, then this expression (and consequently the variable) will not work as there is no way to determine which F_Quarter value to test. You will need an aggregate function (like Max(), Min() etc). I suggest you provide more information about what you are trying to achieve.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

3 Replies
ariel_klien
Specialist
Specialist

Hi,

Did you try to use SET?

SET vMyVariable=' not WildMatch(F_Quarter,'*Q1')';

Ariel

sushil353
Master II
Master II

Hi,

go to settings> Variable overview

Click on add > give variable name and then click on that variable and in definition box give your expression;

=not WildMatch(F_Quarter,'*Q1')

HTH

Sushil

jonathandienst
Partner - Champion III
Partner - Champion III

Are you planning to use this in a chart or table? If yes, make sure that it is stored without the leading = sign. Ariel Klein's suggestion is correct, except that you need to escape the single quotes like this:


Set vVar = 'not WildMatch(F_Quarter,''*Q1'')';


Use the expression in a $ expansion. Provide more details about your use of the variable for more specific help.

If you are planning to use this in a context where F_Quarter has more than one possible value, then this expression (and consequently the variable) will not work as there is no way to determine which F_Quarter value to test. You will need an aggregate function (like Max(), Min() etc). I suggest you provide more information about what you are trying to achieve.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein