Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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)
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.
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.
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