Using Run Flow For CSV StepLast Updated: 07/15/2016 Introduced in Verision: 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.
Example:
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 Or Copy 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.
Our Data Definition should look like following. We can click Add to continue.
Next, we add Run Flow For CSV step from All Steps [Catalog] > Data > List > Excel and CSV category in the Flow Designer Wizard.
Then, we add Download File Form from the Flows, Rules, Forms and Reports > Forms[Interaction] > [Current Folder] category.
This form was predesigned for this tutorial. It 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 or Copy Data step on the workspace. Then, we navigate to its Properties. Next, we locate Inputs section and using Value picker we select our Excel File.
Then, we select Run Flow For CSV step on the workspace and configure its Properties as follows…
When finished configuring this step, we click Open Flow link from this step’s Properties.
New Flow Designer window opens… We are going create a Flow that will Run For CSV here.
First, we add Replace Row step from All Steps [Catalog] > Data > List > 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 fileType and input fields. Next, we define Constant value for newRow. In this example we want to replace second Row in our Excel Document. We define rowNumber as 1 because Rows are zero indexed in this step. 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.
Note that in Decisions version 3.5 and above, you will need to click Test Flow rather than Debug Flow.
Our Download File Form opens in the Debugger and we click Download File control.
Then, we Name our updated File and Save it.
In the Debugger Decisions informs us that the File Was Saved.
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 second Row was replaced for the value we have provided in the sub Flow.