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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Comparing a variable with a string seems not working

I three buttons that each one sets the same variable through an action.

for example:

button A -> sets Var = 'A'

button B -> sets Var = 'B'

button C -> sets Var = 'C'

then I have three containers, which they are visible depending on Var value, for example, I set the condition for each one:

container A -> =if(Var = 'A',1,0)   // it means, if var='A' then container A is visible, otherwise container A is hidden

container B -> =if(Var = 'B',1,0)  

container C -> =if(Var = 'C',1,0)


If I click on button A for example, container A should be visible, but containers B and C hidden

If I click on button B for example, container A should be visible, but containers A and C hidden

If I click on button C for example, container A should be visible, but containers A and B hidden


Variable Var is correctly set on each button click with the correct value but the problem is:

If container B is hidden and I click on button B, then container B remains hidden and it should be visible. It seems like condition set in container always execute the 'else' part of the if statement.


Any ideas?

1 Solution

Accepted Solutions
sunny_talwar

Try these conditions

Var = 'A'

Var = 'B'

Var = 'C'

No need to add the if statement

View solution in original post

3 Replies
sunny_talwar

Try these conditions

Var = 'A'

Var = 'B'

Var = 'C'

No need to add the if statement

Not applicable
Author

Great! Sunny!

But using $(Var)

$(Var) = 'A'

$(Var) = 'B'

$(Var) = 'C'


Anyway correct answer for you

trdandamudi
Master II
Master II

Can you please post a small sample app...