Reading Text Files from a File System
- Updated on 09 May 2013
- 1 minute to read
TheRead Text File component reads and outputs the contents of a file as plain text.
To add it to a flow within the Flow Designer, go to the Toolbox panel, expand the category Integration > File and then, drag a Read Text File component to the workspace.
This example begins with the assumption that our file system contains a text file called Sample Text File .
The example flow will read this file and display its content inside of a form field. The form, Read Simple Text File , already exists, and is simply configured with a Text Box Multi Line form control, label, and a button:
The first step in our flow will be the Read Text File component.
In theFlow Designer Quick Add window, go to Integrations > All Integrations > File , select a Read Text File component. Click Add to add it to the workspace.
The next step in our flow will be the form we use to display our file contents -Display Sample Text File Form - which is in theToolbox panel, under the categoryForms [Interaction] > [Current Folder] .
Next, configure Read Text File by selecting it and clicking the Edit Input Mappings link on theActions Toolbar .
Our example flow requires thatRead Text File should read the file C:\SampleTextFile.txt , so give the input file Name a mapping type of Constant and a value of the path and file name. With that done, we can clickOK to close the Mapping Editor .
ConfigureDisplay Employee Status Report by selecting it and clicking the Edit Input Mapping link in the Actions Toolbar.
Our example flow requires thatDisplay Sample Text File Form should display the file contents provided by Read Text File step**.** Therefore we will map the output ReadTextFile_Output to our form's input FileData. Click OK to close the Mapping Editor. Click the Debug Flow link to test the flow.
In the debugger, we're presented with a form with one field containing data from our text file.