Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
reivax31
Partner - Creator III
Partner - Creator III

Loop variable script

Hi Qlikers,

I'm trying to perform a loop between my script and my app visualization using variable extension. So In my script I'm loading a table with a list of country and Status.

So what I want to do is to select a country in my chart. If one country is selected then a variable is set to the value of my country. (if more than one country is selected my variable has no value displayed).

vCountry = [Country]

Then I have another variable vStatus that I can switch from "OK" to "NOK".

So if I select SPAIN in my chart and OK on my variable extension I will have:

vCountry=SPAIN

vStatus=OK

Then I trigger the reload button on the following Script:

LOAD

[Country],

If([Country]=’$(vCountry)’,’$(vStatus)’,[Status]) AS [Status]

From …

Store … into ….

The problem is that when I trigger reload, in the script vCountry doesn’t anymore equal ‘SPAIN’ because my filter is not taken into account. So is there a way to select a country in my chart (without creating the entire list with variable extension) and to make user it is set in a variable that I can use in my script?

Thanks for your help

1 Solution

Accepted Solutions
rubenmarin

Hi xavier, the value stored in vCountry is [Country], in front-end in an input box it can show SPAIN, but the stored value is still [Country].

Maybe you can try adding another action to the OK/NOK button that also stores the value selected in the vCountry variable Action-> set variable -> Name: vCountry; Value: =[Country]

View solution in original post

2 Replies
rubenmarin

Hi xavier, the value stored in vCountry is [Country], in front-end in an input box it can show SPAIN, but the stored value is still [Country].

Maybe you can try adding another action to the OK/NOK button that also stores the value selected in the vCountry variable Action-> set variable -> Name: vCountry; Value: =[Country]

reivax31
Partner - Creator III
Partner - Creator III
Author

Hi Ruben,

Sorry for my late reply. Your solution worked perfectly. Thnaks for your help !!