Using Run Flow For CSV StepLast Updated: 07/13/2018 Introduced in Version: 2.0
This tutorial shows how to use Run Flow For CSV step. This step can be found in Data > List > Excel and CSV category in the ToolBox.
In this Example we will use Run Flow For CSV step to replace a Row in the Excel Document using this subflow Step.
We begin in the Designer Folder with clicking Create Flow on the Folder Actions panel.
Next, we Name the Flow and click Create to proceed to the Flow Designer.
In the Flow Designer we add Create Data step from All Steps [Catalog] > Data category in the Flow Designer Wizard.
In the resulting Data Definitions pop-up window we click Add New link to add new data definition for this step.
Then, we Name our Data Definition and pick FileData type for it, using Type selector.
Next, we add Run Flow For CSV step from All Steps [Catalog] > Integration > Excel and CSV category in the Flow Designer Wizard.
Then, we add a Form from the Flows, Rules, Forms and Reports > Forms[Interaction] > [Pick or Create Form].
This form has two controls on it:
- First – Button control from Actions category for Form to have at least one Outcome.
- Second – File Download control from File Handling category for user to be able to download edited Excel Document.
Now, we can pick our Excel Document for the Create or Copy Data step. The Excel Document we are going to use in this Example looks like following:
First, we select Create Data step on the workspace. Then, we navigate to its Properties. Next, we locate Inputs section and using Choose File we select our Excel File.
Then, we select Run Flow For CSV step on the workspace and configure its Properties as follows.
In the Current Designer Folder, find the associated Flow for CSV. The flow is automatically generated and sits in your Current Designer Folder, renamed with an underscore (e.g. main flow: FlowName, sub flow: FlowName_ ). Open this flow.
The Flow Designer window opens.
First, we add Replace Row step from All Steps [Catalog] > Integration > Excel and CSV category in the Flow Designer Wizard.
Next, we connect Replace Row step to the End Step. Call Mapping Editor for the Replace Row step from its Action Menu.
In the Mapping Editor we use RowData input to this Sub Flow for defining file Type as FileType (CSVFileType) and input as FileData (FileData) fields. Next, we define Constant value for new Row. In this example we want to replace the first Row in our Excel Document. We define row Number as 0. We click Ok to save and close Mapping Editor.
Back in the Flow Designer we select End Step on the workspace. Using Step Information Layer we map Data for the predefined OutputData variable. We select Mapping type as Select Value, and using Path picker we pick the outcome data from Replace Row step. And this completes our Sub Flow. We can save it and close this Flow Designer.
Back in the Main Flow Designer we select our Form Step and choose Show Mapping Editor option for this Step.
In the Mapping Editor we are using First file from the ResultList (the outcome from Run Flow For CSV step) as an input for our DownloadFile control. Then, we save and close Mapping Editor.
Back in the Flow Designer we connect all steps in our Flow as following… This, completes our Flow. We click Debug Flow link on the Top panel of the Flow Designer to test our Flow.
Our Download File Form opens in the Debugger and we click Download File control.
Then, we Name our updated File and Save it.
We click Done control on the Form to close it.
Diagram Tab in the Debugger indicates that our Flow executed successfully with no errors.
When we locate and open our Updated Excel Document, we can observe that first row was replaced for the value we have provided in the sub Flow.