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: 
tonytang
Contributor II
Contributor II

How to create formula in variable field for button?

Hi,

 

Is there any way to construct a formula in the variable field for button? I found it doesnt work. My purpose is very simple. If the variable (vCurr=1), then i use the column  [Product Category] to get, otherwise i use Product Sub-Category to get value. 

tonytang_0-1637168695966.png

 

But, the function does not work. Is there any way to achieve the effect?

Thanks

 

1 Solution

Accepted Solutions
MayilVahanan

HI 

Try like below

=if(vCurr = 1, '[Product Category]', '[Product Sub-Category]')

MayilVahanan_0-1637221721619.png

 

Use the vFieldName variable where its required like below

$(vFieldName)

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

2 Replies
MayilVahanan

HI 

Try like below

=if(vCurr = 1, '[Product Category]', '[Product Sub-Category]')

MayilVahanan_0-1637221721619.png

 

Use the vFieldName variable where its required like below

$(vFieldName)

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
tonytang
Contributor II
Contributor II
Author

it works. Thx