File Reader¶
Characteristics¶
File Reader monitors a specified folder - the so-called input folder
If a file is inserted the following actions take place:
After successful execution of the rule the file is moved into a so-called output folder
In case of an exception the file is moved into an error folder
The File Reader can be used for different file formats like CSV, JSON and XML
Information Model Requirements¶
The first Node after the root node must be of type Event . Depending on the file format, the Information Model needs to be built up accordingly:
CSV¶
Reading multiple lines from a CSV file requires a List .
Data in the CSV columns is represented by the Node Type Variable . Note that the order of fields in the CSV file must match the order of Variables in the Information Model.
Below is an example of a CSV file containing multiple records and the corresponding Information Model:
JSON¶
Reading a JSON file containing a list structure requires a List .
Keys are represented by the Node Type Variable .
Below is an example of a JSON file containinga list and the corresponding Information Model:
XML¶
Elements of the XML file are represented by the Node Type Variable .
Attributes of the XML file are represented by the Node Type Property . In order to assign attributes to elements in the Information Model, the element Node Type must be a Custom Data Type.
Below is an example of a XML file containing multiple records and the corresponding Information Model:
Configuration¶
In this example, the setup of the File Reader for CSV is illustrated.
Select the File Reader with the file format to be used from the Drop-Down.
Click the Configure button.
Ensure the root model node is selected to configure the File Consumer to String as well as the CSV String to Model.
File Consumer to String - Configuration
Enter a path for the input folder - In Folder
Enter a path for the process folder - Process Folder
Enter a path for the output folder - Out Folder
Enter a path for the error folder - Error Folder
Specify the Polling interval and select the Unit
Select the CharSet according to the file in use
CSV String to Model - Configuration
Enter the Separator which is used in the CSV-file
If needed, set String delimiter, EOL delimiter and the Timestamp format
If the CSV file contains a header enable Ignore first line
Specify the Polling interval and select the Unit
Note
To configure XML to Model or JSON to Model navigate to the respective sections.
Specify the Event used by selecting the event node in the tree on the left side
File Consumer to String - Configuration
Enable the Event checkbox for the File Name Filter
Enter a Regular expression in order to determine which file is to be processed in the input folder
CSV String to Model - Configuration
Enable the Event checkbox for the Csv Model Configuration
Start of processing
If the entire content of the file is processed on this event enter a wildcard in the RegEx field
If the processing starts at a specific line enter a regular expression in the RegEx field to identify the line
Click the Apply button, then the Close button and save the Channel by clicking the Save button
Description of configuration properties:
Property |
Description |
Example |
---|---|---|
Separator |
Separator type, used in the csv file |
|
Delimiter |
Values that have an additional delimiter like “Date”, “Time” |
|
Eol Delimiter |
Defining Carriage return and/or Line Feed |
|
Timestamp format |
Format of the timestamp |
|
ignoreFirstLine |
Delay between checks of the file for new content in milliseconds |
|
TailFromEnd |
Set to true to tail from the end of the file, false to tail from the beginning of the file |
|
InFolder |
Path leading to the Input Folder |
|
OutFolder |
Path of a node in the Information Model |
|
ErrorFolder |
Regular Expression for the message filter used in the implementation |
|
CharSet |
Encoding of the file in use |
|
ProcessFolder |
Regular Expression for the message filter used in the implementation |
|