Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
reivax31
Contributor 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

Tags (2)
1 Solution

Accepted Solutions

Re: Loop variable script

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]

2 Replies

Re: Loop variable script

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
Contributor III

Re: Loop variable script

Hi Ruben,

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