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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
zagzebski
Creator
Creator

Set Variable action not working as expected

Wondering if anybody has experience the following before as I haven't.

I have a text box with the following actions with the default of vCustPremium set to "0".

1. Clear Customer field

2. Set Customers field: Premium Greater than 1000

3. Set Variable vCustPremium to:  If(GetSelectedCount(Customers)=0,1,0)

My problem is that the first time I click on the text box even though after the 2nd action there are no fields with Premium greater than 1000, it still keeps vCustPremium = 0. However when I click it a second time it correctly sets the vCustPremium = 1.

Why do I have to click the button twice to get the variable to set to 1?

Thanks in advance,

Zag

15 Replies
tamilarasu
Champion
Champion

Sunny, I have the issue in specific qvw file and not all the files. So, we need to test the original file. 

sunny_talwar

May be there are other triggers or actions that have contradicting effect on selections? Not really sure what could be the problem without seeing it.

trdandamudi
Master II
Master II

Nagaraj,

I am using version 11.20 SR 9 and tested your sample file and everything looks good. As Sunny said, if there are other triggers or actions then they are contradicting... Matter of fact when I had this issue long back I do have handful of triggers and actions on each button and I had half a dozen of buttons on the sheet.

Let's see if Zag will post a sample file....

zagzebski
Creator
Creator
Author

File attached. Thanks.

Zag

sunny_talwar

Step 1: Click on Property and Casualty button

Capture.PNG

You field %KeyBoBBStratification get nothing selected. Although I see a selection criteria within the button for %KeyBoBBStratification but nothing actually gets selected

Step 2: Financial button

Capture.PNG

You have this variable action

Capture.PNG

So since we did not have anything selected in %KeyBoBBStratification when we clicked on Property & Casualty, the GetSelectedCount(%KeyBoBBStratification) = 0 meaning the variable vCrossSellNoCustomersFilter will be assigned the value 1.

But also notice that when you clicked Financial for the first time C got selected in %KeyBoBBStratification. So now if you select Financial button one more time, you will see 0 because now the GetSelectedCount(%KeyBoBBStratification) = 1

Not sure if this can be fixed by just fixing the action within Property and Casualty button which will make certain selection in %KeyBoBBStratification, but that is where I would start my troubleshooting.

Best,

Sunny

tamilarasu
Champion
Champion

Sunny, Thirumala,

            Yes. I too have many triggers in my application. I'll check and try to find the reason when I get time. Thank you guys for the suggestion.