File Splitter
Purpose
Splits a file into two or more new files based on various rules.
At runtime the node loads a file and reads it line by line. One or more rules are run against the data items in each row and the rows are split from the file depending on whether the rule results in a true or false condition.
For example you can have a rule that acts on the amount field in a file. If it is under 1000 then the row goes into file 1 otherwise the row goes into file 2. This results in two files - one only contains rows that have an amount of less than 1000. The other only contains rows of more then or equal to 1000. The file has effectively been split by the amount field.
Configuration
Group
Start by selecting the correct group. The node takes various settings from the group.
Importer
The file splitter node makes use of a previously create Importer to be able to function correctly. When you create an import you tell the workflow what each part of the imported file refers to.
Source Filename
This is the path to the incoming (imported) file. If required, use the file browser button to set the correct path.
Output Files
The output files section is where you tell the workflow engine the names of the new files that the splitting process will create.
Click ‘add’ to add a new output file. Now use the file browser button to navigate to an existing file or enter a path into the text box directly, for example
\myfolder\credits.dat
Note that the file has a number associated to it. The first file you is 1, the second 2, etc. You will need this file number later when we add rules.
Rules
Rules are how the File Splitter node determines how to split the contents of a file.
Click ‘Add’ to add a new rule to the process. Rules are executed sequentially - the first rule will run all the way through the file and then the second rule will run followed by the third, etc.
When creating the importer that loads the file you will have identified the various fields in the file: the amount, date, sortcode, etc.
Rules act on these fields with in a way that always results in either a true or a false.
For example.
100 Is greater the 10 -> Results in a true.
Rule Validity
not all item and condition combination are allowed. Asking if the number 10 is in the future is clearly unsupported because is cannot result in a true or false result - and, of course, it makes no sense.
If a rule is found to be invalid a small red warning triangle is shown at the top of the rule section.
The following table can be used to help determine which conditions work with which items.
Condition | Meaning | Supported Items | Example |
---|---|---|---|
= | Equal to | All, text Fields | |
!= | Not Equal to | Amount | 1000 |
< | less Than | Amount | 123.45 |
<= | Less Than or Equal To | Amount | |
> | Greater Than | Amount | |
>= | Greater Than or Equal To | Amount | |
Starts With | Test Fields including names sort codes and account numbers | 404 | |
End With | “ | Jones | |
Contains | “ | 0C | |
Is Today | Dates Only | ||
Is in Past | Dates Only | ||
Is in Future | Dates Only | ||
Notes
The imported file is unmodified by the splitting process.