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.
First of all you have to create two different variables for each file. One variable will get selection of the file and the other will be empty variable, so that you can pass first variable value to empty variable in the Automation part and do the same for 2nd file also.
Now in automation, you have to get variables value using GET EXPRESSION VALUE block by inputing variable name which contains the selections of the your files.
Now use UPDATE VARIABLE Block to update the empty variable you created in app and in the definition part,use the output of GET EXPRESSION VALUE.
After doing this, Use SAVE APP Block and enter the Id of your app and then use DO RELOAD Block.
this will solve your Problem.
Thank you for your reply. It has been some time since my original post and other tasks have taken priority. Once I have some time, I will test out this method. I did try many similar iterations to your suggestion, but I may have missed something. I hope that is the case and will report back with more details after I have done this.
I have implemented your suggestion and it works occasionally. I cannot pin point exactly why it does/doesn't work. I tacked on to the end of my load script LET statements to reset the value of the 2 variables I am updating with the automation since you said i need to pass the value to an empty variable.
The first time i enter the app for the day, i select the 2 files from the 2 lists, click reload, and it works.
If I then select other files, click reload, it will not update. If i comment out the LET statements at the end of my script and then click the same reload button in the app, it will normally reload correctly (sometimes it doesn't).
Again if i change my file selection and reload, it again wont reload. If i then Un-comment out the last LET statements and reload again, it will again normally reload correctly (sometimes it doesn't). If it doesn't work on the initial reload after commenting/uncommenting out the LET statements, it will always work after undoing what was just done.
However, it NEVER works twice in a row. the load script must always have a change made to it at least once before it will correctly reload the new selections.
Any thoughts as to why this may be? I change my selections in the app and check my variable values. the ones i am pulling from in the Automation show the correct values when i look at them prior to running the automation. If i look at the details of the automation, it is pulling the old values from the prior reload when it does not work.
variable values.png shows the value of the variables selected (1) and blank variables that will be assigned in the automation (2) which are correct.
automation values.png shows the value the automation is pulling from the app which are the old values and are not the values shown in the variable values image. The get expression value block is set to "expression:=vFileOldSelected". The get expression value block 2 is "expression:=vFileNewSelected".
HI Blaise, Thanks for the reply, but I do have a save app block after I've reassigned the variable values which is just before I am doing the reload. it shows in the automation values.png image.
Hello Salmankojar, what exactly do you mean by 'in front end'. I'm assuming it means in the app sheet view rather than the load script which is what i've done. in my image, the first 4 variables are created and set within the load script while the others are in app.
I reload the app daily with the newest file and compare against the file from the end of the prior month, so i need some logic to use the user defined variable value when using the automation reload and instead the standard reload files when it reloads nightly. Below is my script to determine the file to use for the reload depending on which reload it is.
let vFileOld = if('$(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');
let vFileYest = if('$(vFileNewSelectedAssigned)'<>'',
date(today()-1,'YY.MM.DD') & '-SHOO.qvd');
Since you are saying i need to use a blank variable for automation to assign a value to, i assume i need to reset the '...Assigned' variables to a value of '' somewhere apart of the load script. if not, where do i do this? i tried to add a step to the reload button to set the values to '' after the automation was complete, but it did not work.
Thank you for all the assistance so far!
load * FROM [lib://SHOO:DataFiles/$(vFileOld)] (qvd);
load * FROM [lib://SHOO:DataFiles/$(vFileYest)] (qvd);
vFileOld and vFileYest either hold the values of file names for the last of the prior month and 1 day ago if the file is reloading via the automatic nightly reload or the user defined file names from the selection in the app when reloading manually via button/automation. if the automation is being run, the value of the 'vFileOldSelectedAssigned' and 'vFileNewSelectedAssigned' will have a value and be used. if it is the nightly reload, they should not have a value, and the standard calculation shown in the prior post will be used to define the 2 files.