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

Variable in App to be used in Script

Good Afternoon. 

I would like to enable a User to specify the number of Month's data to load. I have a variable in the script "SET v_Reload_Months = '24';" that gets used in the LOAD script, 

LOAD * FROM [TRANSACTIONS_ALL.qvd](qvd)
WHERE  (Monthstart(Date) <= monthstart(today()) and Monthstart(Date) >= monthstart(today(),-'$(v_Reload_Months)')); 

This works fine at reload time. I am looking for a way to let the user change the variable in the app and then reload the app for the new number of months. The variable is visible in the app but I don't know how to get the value back to the script! 

Any ideas? Thank you. 

 

1 Solution

Accepted Solutions
4 Replies
Tomer_St
Contributor
Contributor

Hi,

In order to let the user updating a varaible you can keep an excel file in a shared folder with a table of 1 row (header = Reload_Months, and the first row will be update by the user). You can read this data with Load statement and save the number of months as varaible using peek function (Let v_Reload_Months = peek(...).
If this solution seems to answer your need I can share an example of how to implement it.

Best regards
johngouws
Partner - Specialist
Partner - Specialist
Author

Hi. 

Thanks for the reply. If I understand you correctly, the user needs to update the spreadsheet every time they want to change the variable value? This is in a Forecasting environment and they may want to run up to 20 simulations in a day. May be a bit cumbersome. I will give it a try. 

dplr-rn
Partner - Master III
Partner - Master III

If you were in qlikview you could use input fucntion which i dont beleive you can use qlik sense.
Another option (apart from the excel) is to use set analysis for this but you would need to use the set analysis in every chart. but user experience would be better. but you will need to load everything into the app not sure what your data volume is