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

Pass variable to automation

I have an app which has the purpose of allowing a user to select 2 files saved off by the system each day and then perform comparisons to see how the numbers have changed within the file between the 2 days.

A little more detail is I’m pulling 2 duplicate lists of qvds that are saved off every day via another app. this field is set to only allow one value to be selected. Each table has its own ‘alternate state’ so I can tell the exact file that is selected in each state. 

I have variables defined that I can pass these file names to to define the 2 file names that need to be loaded when the app is reloaded.

if I use a ‘button’ with actions to save off these variables and do a reload, the app works. My understanding is this standard reload will not work for the basic analyzer user account so I’m trying to achieve this via automation.  I use the same button that saves off the files selections in the variables but replace the basic reload with an execute automation that reloads the app.  This however does not work and the variables are not updated and passed into the automation for use (they remain the old value). It is like the automation is pulling the value of the variables from a different instance of the app.

Any suggestions that can be provided would be most appreciated How do I pass a value a user defines within a sheet of an app into an automation? Or maybe there is a better way all together to achieve this? I’ve tried get variable blocks and get straight table blocks to pull the selected values from the sheet, but they never change from the values of the last successfully loaded instance.

Thank you!

James

Labels (2)
13 Replies
salmankojar
Creator
Creator

First of all create all variables in analyze sheet..even your vFileOld and vFileYest should be made in analyze sheet and both should be blank variables with no definition.

Then create another two variables which will select your files as per your requirement..

For example vFileOld1 = if('$(vFileOldSelectedAssigned)'<>'',

'$(vFileOldSelectedAssigned)',
if(day(Today())=1 or day(Today())=2,date(AddMonths(today()-day(today()),-1),'YY.MM.DD'),date(today()-day(today()),'YY.MM.DD'))&'-SHOO.qvd')

Similarly create vFileYest1..

Now in automation use Get Expression value blocks and give inputs as =vFileOld1 and =vFileYest1

Now using Update variables block update variable vFileOld and give its definition as = Get expression value1..

Similarly do it for vFileYest also..and then use save App block and then do reload..it should work smoothly..its working smoothly in my case..

Jebrezov
Contributor III
Contributor III
Author

I've trimmed out a lot of extra stuff I had in an attempt to get it working, and I'm still getting the same situation where upon second reload with a second set of selected files, the automation pulls in the old rather than the new selection. This continues for as many times as i try to reload until i modify something within the load script and then use the automation reload, at which point it will correctly reload.

I took out extra variables, and i am just using a variable to store each selection and another to store the value the automation pulls and assigns for the reload. all are created within the front end app sheet. 

One question i have relating to the final variable being assigned by the automation update variable block... you say it must be blank variables with no definition. after the first reload, it now has a value. Are you setting its value back to be blank somehow before your next reload? i've manually deleted the value stored in the variable after the first reload and it didn't have an effect, but i figured i would ask. 

I appreciate all the help and suggestions. It does work once for an end user, but would not work for subsequent reloads after the first it seems. I find it odd that it works if i modify the load script and try immediately after that. It's like the automation is not resetting after the first reload and has the original instance of the app still loaded in memory or something until i edit something in the script editor.

 

Jebrezov
Contributor III
Contributor III
Author

For those experiencing a similar situation as myself, I've found a helpful video that suggested a step i was not doing that i believe assisted in making sure the automation was using the selections from the app where the button was clicked. i've changed my selections and refreshed my app and it is now loading with the new values each time. 

https://www.youtube.com/watch?v=hYER2nGKctM 

basically after formatting the button to execute an automation, you can click on the below "copy input block" button in the below image and navigate back to your automation and paste. this will add an input block and bookmark block to the automation with relevant information from the app the automation was triggered from. these should likely be the first 2 blocks of the automation so the fields can be referenced in blocks further down the line.

Jebrezov_0-1702409622541.png

 

salmankojar
Creator
Creator

I thought you already did the above step..so i didnt said anything about it..Anyways i hope you find your desired solution..

Thankyou.