Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
asif_shah
Contributor
Contributor

Pass current selections from Qlik Application to Qlik Application Automation

I am using the template "Store a straight table as a .csv file on Amazon S3" to store straight table data to S3 bucket.


What is working: I am able to store a .csv file to S3 bucket on the click of a button configured in Qlik application.

What is not working / Need help with:

1. There are filters (MonthYear, Plant) provided to user in front end after which the user would click on the button to run the automation and the automation will take the straight table object and store the data in .csv on S3 without applying the filters that was selected on front end before running the automation.

2. Filters will always have one value selected and the same needs to be used for .csv file naming. for e.g. file name needs to be MonthYear_Plant_Test_TimeStamp.csv where test would be the actual file name and MonthYear_Plant_ as prefix and _TimeStamp as suffix

Labels (5)
1 Reply
PhilipZ
Contributor II
Contributor II

Hey, you should be able to solve this by using variables.

In your script, add 2 variables like this:

 

LET monthYear = '';
LET plant = '';

 

 

In your app, in the button that triggers the CSV Export. Add 2 operations "set variable value" (Make sure to place them before the operation that triggers your Automation!).

In each operation, you want to set the value of the corresponding variable with the selection of your field by using the "GetFieldSelections()" function.

E.g.

 

=GetFieldSelections(yourMonthYearField)

 

PhilipZ_0-1711105144994.png

 

In your automation, you have to get the variable values with the Qlik cloud services "Get Variable" Block.

Do a lookup on your app Id and variable name.

PhilipZ_1-1711105421288.png

And then add the selection to your app by using the Qlik cloud services "Select Field Value" Block.
Again, just do a lookup on your app Id and Field name. For the field value, pass the "qDefinition" Output from your "Get Variable" Block.

PhilipZ_2-1711105727056.png

You have to do both steps for both fields.
This should set the Values for the Automation correctly, so that the export is filtered by the selected values.

For the CSV File name, just pass the "qDefinition" Value from both variables seperated by the underscore.

Hope that works for you 🙂

Philip