Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Changing a variable if a specific field value is selected

Hello,

i defined a variable in my document:

showBrain = 0

Now i have an image with the condition that it will only be shown if showBrain = 1.

I now need some kind of trigger or something similar which detects when a specific value in a table is selected.

So for instance i have the table:

Eye

Brain

Stomache

...

Only if the Brain is selected (exclusively meaning no other value in the table) then the variable showBrain is switched to =1.

Eye

Brain

Stomache

...

Also i need a second trigger. Even if the Brain is selected but anything else within the table is selected then the variable should switch back to showBrain =0.

My biggest problem is that i do not exactly know where and how to define this trigger. I guess in the trigger properties for the document?

But i am not sure. Any help is very much appreciated!

1 Solution

Accepted Solutions
MVP
MVP

Re: Changing a variable if a specific field value is selected

I think there are two ways:

1) Create a variable that changes value depending on your conditions, something like

showBrain:

= If( Only( YourFieldName ) = 'Brain', 1,0)

2) Create a field event trigger OnSelect of  YourFieldName, with an action to change the variable (with a similar expression like above).

I think I would go for 1), since it's easier to understand what's happening when checking the variable.

2 Replies
MVP
MVP

Re: Changing a variable if a specific field value is selected

I think there are two ways:

1) Create a variable that changes value depending on your conditions, something like

showBrain:

= If( Only( YourFieldName ) = 'Brain', 1,0)

2) Create a field event trigger OnSelect of  YourFieldName, with an action to change the variable (with a similar expression like above).

I think I would go for 1), since it's easier to understand what's happening when checking the variable.

Not applicable

Re: Changing a variable if a specific field value is selected

Thank you for that great reply,

i went for your first suggestion and it works great!!!