- 10 Sep 2020
- 1 Minute to read
- Print
- DarkLight
Using Run Flow For CSV Step
- Updated on 10 Sep 2020
- 1 Minute to read
- Print
- DarkLight
Overview
The Run Flow For CSV step allows designers to build custom logic for each row in a CSV/Excel file.
Example
In this example, use the Run Flow For CSV step to change a CSV field into an account.
Begin in the Designer Folder by selecting 'Create Flow' on the Folder Actions panel. Next, name the Flow and select 'Create' to proceed to the Flow Designer.
In the Flow Designer, add the Create Data step from the All Steps [Catalog] > Data category. In the Properties panel of the Create Data step under Data > Data To Create, select 'Show Editor.' Name the piece of data "File" with the type of FileData. Change the input type to Constant and upload the following example CSV file.
Add a Run Flow For CSV step from All Steps [Catalog] > Integration > Excel and CSV category in the Steps panel.
Configure this step by navigating to the Configuration section in the Properties panel. Set the Data Format to CSV, choose to IgnoreFirstRow. In the OutputType drop-down menu, type in Account and select the DecisionsFramework Account. Leave the Separator as Comma.
Next, under Inputs > File Input, select the "File" from the output of the Create Data step.
Finish configuring this step by selecting Edit Flow.
A new Flow Designer window will open. Connect the Start step to the End step.
Select End Step on the workspace. Output Data should automatically be set to the Account data type as it was defined on the Run Flow For CSV step. Change the Output Data mapping type to Build Data, choose properties that match the properties in the CSV file. In this example, EmailAddress, First Name, and Last Name are selected. For each property, change the mapping type to Select From Flow and select the proper RowData. Looking at the CSV file, First Name is the first field, so the input for "First Name" should be RowData.Field01.TextValue. The input data for "Last Name" is RowData.Field02.TextValue. The input data for "EmailAddress" is RowData.Field03.TextValue.
Save and close the Flow Designer.
Debug
Connect the Run Flow For CSV step to the End step. Select Debug in the top action panel. The Flow runs as expected. Select View Input/Output Data on the Run Flow For CSV step, notice how the input was a CSV file and for each row in the file, an Account is being passed out.