How to create a CSV file with the Cloud Storage connector in Qlik Application Automation
This article explains how the Cloud Storage connector can be used to create CSV files. Note that this is a generic connector that can be used with multiple platforms.
Dropbox (live in Qlik Application Automation)
Amazon S3 (coming soon to Qlik Application Automation)
FTP (coming soon to Qlik Application Automation)
SFTP (coming soon to Qlik Application Automation)
Google Cloud Storage
Steps to create a CSV file:
This example uses Dropbox but the process is similar for the other platforms.
Search for the "Create File" block from the Cloud Storage connector and drag this inside the editor and connect it to the "Start" block.
Go to the inputs tab of the Create File block and select "Dropbox" as the connector.
Specify the path for your new file, this should also include the filename and file extension. For example, "retail_contacts.csv".
Go to the datasources tab of the Create File block and click "Connect new datasource" to connect your dropbox account.
Search for the "Write Line To File" block from the Cloud Storage connector and connect this to the "Create File on Dropbox" block.
Go to the inputs tab of the Write Line To File block and select your file from the Create File block as the value for the File parameter.
Specify the line of text you want to write to your file. This block will only allow for 1 line to be written to your file, so let's use it to write the file headers.
Select CSV as Mode.
Specify the header rows
If the data in your source might be incomplete, it's best to specify the column names in the "Column names" field to make sure that each value is mapped to the right column.
Now search for a connector you want to use as the source of records. This should be a list block. For example, the "List Contacts" block from Salesforce. Drag this block in your blend and connect your Salesforce account.
Because the List Contacts block returns a list, it has a loop attached to it. When the blend is executed, the blocks inside this loop will be executed for each item in the list returned by the List Contacts block.
Specify additional fields you want to retrieve from Salesforce in the Extra Fields input parameter in the inputs tab on the List Contacts block.
Drag a new "Write Line To File" block inside the loop of the List Contacts block.
Click the Data field in the inputs tab and select "Item" from the list returned by the List Contacts block:
Now click on the "List Contacts > Item" placeholder that appeared in the Data field and click "Add Formula" in the dropdown that appears.
Search for the CSV formula. Inside the CSV formula settings specify the columns if you don't want to use all keys from the contact object. Click save, the placeholder in the Data input field should now look like the following image:
To finish the file, search for the "Save And Close File" block from the Cloud Storage connector and connect this to after the loop from the List contacts block.
Go to the inputs tab in the "Save And Close File" block. Your automation should now look like this:
Bonus tip: add a comment to each block, this makes the automation easier to comprehend. To add a comment to a block, right-click the block and select "Edit comment'.