File ReferencesLast Updated: 08/11/2016 Introduced in Verision: 2.0
File references allow large files to be saved in the file system rather than memory, but still be usable in the Portal. By default, uploaded files are stored in memory for fast retrieval and indexing. In most circumstances, this way of file processing works well, but when large files enter the pool, the system can be slowed down. It is better to store these files on the server’s file system and to refer to them with file references.
They are stored in a dated (DD-MM-YYYY) subfolder in C:\Program Files\Decisions\FileStorage.
There are two ways to create a File Reference in the Flow using Load From File Data or Load From Path step.
In our Example we will prompt user to either pick file or type the path to the file location and create File Reference to the file.
We start in the Designer Folder and click Create Flow to create a New Flow.
Next, we name our Flow and click Create to proceed to the Flow Designer.
First, we are going to create a new Form for our Flow. We expand Flows, Rules, Forms and Reports > Forms[Interaction] category and select [Pick Or Create Form] step. We click Add to add this step to our workspace.
Our Form is designed as follows. It has a File picker and a Button to get a File Reference using File Data. Next, it has a TextBox to let the user input a Path to the File and a Button to get File Reference using Path. When we are finished designing our Form we can save and close it to return back to our Flow Designer.
Next, for our Get File Reference For File Data outcome from our Form in the Flow Designer Wizard we expand All Steps [Catalog] > Data > File category and select Load From File Data step. We click Add to add it to our workspace.
For our Get File Reference By Path outcome from our Form we expand All Steps [Catalog] > Data > File category and select Load From Path step. We click Add to add it to our workspace.
Next, we select Show Mapping Editor for our Load From File Data step.
We map File that is going to be picked by the user in our Form to the file field.
Next, in the same way we perform mapping for our Load From Path step, but this time we use the string with the Path that the user is going to input into our Form, and map it to our step’s filePath field.
We are going to create another Form to display the results. We create a new Form using Flows, Rules, Forms and Reports > Forms[Interaction] > [Pick Or Create Form] step. Our Form is designed with a TextBlock and a Button. The TextBlock will display TextMerge that looks as follow:
We connect our steps as shown. This completes our Flow. We can click Debug Flow from the top panel in the Flow Designer to test our Flow.
Note that in Decisions version 3.5 and above, you need to click on the Test Flow link to access the Debugger.
For our test we are going to use next file…
First, we are going to pick our File using Explorer and click Get File Reference By File Data.
And we are getting the expected result.
If we look at the Diagram in our Debugger we can see that the Flow ran with no issues and it ran using Load From File Data step.
On the second run we type the Path to our File into the TextBox and click Get File Reference By Path button.
And the result is as expected…
The Diagram shows that this time flow ran using Load From Path step.