Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
valerio_trotta
Contributor III
Contributor III

Pass variable from front-end to loading script

Hi everyone,

 

can i let a user define the value of a variable from the front-end of QlikSense and than use that same variable in the loading script?

For example, let's say that i want to give the user the possibility to filter the all loading of a table by setting a year (silly example i know). Ideally i would let the user define the year inside a variable, then can i use it to filter a table in the loading script?

 

I'm developing the app o Desktop but i would like to bring it to the enterprise system.

 

Thank you

VT

2 Replies
Kellerassel
Contributor III
Contributor III

Yes, that works. You can define a variable either inside the script or in the variable editor of the front-end and allow the user to enter a value by putting a Variable Input object from the Qlik Dashboard Bundle. 

Then also add a Button object and assign it the action Reload Data.

In your script you need a query along the lines of:

/* Set vYourVariable = SomeValue; */


YourData:
Load *
;
SQL SELECT *
FROM your_table
WHERE your_field = '$(vYourVariable)'
;

 
Every time the button is clicked the script will be executed and data will be loaded according to the current value of vYourVariable. If you create the variable in the script, don't forget to comment out the statement after the first run of the script otherwise the users setting will always be overridden.

SunilChauhan
Champion II
Champion II

Take input box and Button . in Inputbox set Variable at front. on Button allow reload action.

Sunil Chauhan