- 08 Apr 2020
- 2 Minutes to read
- Print
- DarkLight
Getting File Data From a Document
- Updated on 08 Apr 2020
- 2 Minutes to read
- Print
- DarkLight
Overview
In Decisions, there are steps that allow a user to use the data within a document that has been uploaded in Decisions and have it available in the flow engine. The following example will show you how to take a text file and use a Flow step to extract the contents and put it on a Form.
Example
In this example get data from a Document and display it on a Form. The document used in this example is a list of airports and can be downloaded below.
Below is a downloadable example to import into Decisions.
To begin, locate the document in the Portal, right-click and select Manage > Get Document ID.
In the resulting window select Copy Text and select 'Done' to close the window.
Then, in the Designer Folder select Create Flow in the bottom action panel.
In the resulting dialog, name the Flow and select 'Create' to proceed to the Flow Designer.
In the Flow Designer, add GetDocumentData step from Integrations > All Integrations > Internal Services > Document Service category.
Then, select the Get Document Data step. In the Properties panel under Inputs define a constant document ID. Paste the Document ID that was copied earlier.
Get Document Data step returns a FileData type. To display the document contents on the Form, get the text from a FileData type.
Add a Get String From Bytes step from All Steps [Catalog] > Data > Text category.
Next, select the Get String From Bytes step. In the Properties panel under Inputs choose Select from Flow as the mapping type, then pick GetDocumentData_Output.Contents.
Next to the Get String From Bytes step, add a Show Form step to display the contents of the Document.
In the resulting dialog name the Form and select 'Create' to proceed to the Form Designer.
Design the Form as follows: add a Rich Text Display control to display the file data, name the Input Data Name "Airports", then add a Button control to close the Form. When finished save the Form and close Form Designer.
Back in the Flow Designer connect the Show Form step to the End step in the Flow.
Select the Show Form step on the workspace to set up data for it. For the Form's Rich Text Display control Input chose Select from Flow as the mapping type the choose the GetStringFromBytes_Output.
This completes the Flow. Select Debug in the top panel of the Flow Designer.
The Flow runs in the Debugger. The Form opens and the document data is displayed in the Rich Text Display control on the Form. Select the Done button on the Form to close.