Using Run Flow For CSV Step

Last 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.

 createFlowMain

Next, we Name the Flow and click Create to proceed to the Flow Designer.

 nameMainFlow

In the Flow Designer we add Create Or Copy Data step from All Steps [Catalog] > Data category in the Flow Designer Wizard.

 addCreateOrCopyData

In the resulting Data Definitions pop-up window we click Add New link to add new data definition for this step.

 addNewCreateorCopy

Then, we Name our Data Definition and pick FileData type for it, using Type selector.

 dataDefined

Our Data Definition should look like following. We can click Add to continue.

 createOrCopyCompleted

Next, we add Run Flow For CSV step from All Steps [Catalog] > Data > List > Excel and CSV category in the Flow Designer Wizard.

 addRunFlowStep

Then, we add Download File Form from the Flows, Rules, Forms and Reports > Forms[Interaction] > [Current Folder] category.

 addDownloadForm

This form was predesigned for this tutorial. It has two controls on it:

  • FirstButton control from Actions category for Form to have at least one Outcome.
  • SecondFile Download control from File Handling category for user to be able to download edited Excel Document.

FormDesign

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:

 excelFileOriginal

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.

 pickFileForCreateOrCopy

Then, we select Run Flow For CSV step on the workspace and configure its Properties as follows…

 configureRunFlowFor

When finished configuring this step, we click Open Flow link from this step’s Properties.

 openFlowRunFlow

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.

 addReplaceRowStep

Next, we connect Replace Row step to the End Step. Call Mapping Editor for the Replace Row step from its Action Menu.

 showMappingForReplaceRow

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.

 mappingForReplaceRow

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.

 mappReplaceValueOutputToTheEnd

Back in the Main Flow Designer we select our Form Step and choose Show Mapping Editor option for this Step.

 showMappingForForm

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.

 mappingForForm

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.

3.5 Test Flow Shot

 debugFlow

Our Download File Form opens in the Debugger and we click Download File control.

 downloadFile

Then, we Name our updated File and Save it.

 nameAndSave

In the Debugger Decisions informs us that the File Was Saved.

 fileSaved

We click Done control on the Form to close it.

 closeForm

Diagram Tab in the Debugger indicates that our Flow executed successfully with no errors.

 formRanToTheEnd

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.

 

 rowReplaced

Additional Resources