File - Instance & item setup
How to setup a File instance and item to write CSV, JSON, XML or other types of files
The File connector allows the user to read data from .csv-files and utilize that data in their SIA Connect setup.
Furthermore, the connector also allows for the user to write data from other SIA Connect instances into various user-defined files of any supported file type. The written files can then be stored either locally on the SIA Connect device, locally on the SIA Connect Docker instance, or remotely on an FTP server
Below is an outline of the parameters, and how to fill them out according to the specific case
Instance
The instance needs the following parameters to establish a connection to a remote FTP server:
Parameter | Description |
---|---|
Address Only for FTP connections |
The IP address or the URL of the FTP server to connect to. |
Username Only for FTP connections |
The username to access the FTP server. |
Password Only for FTP connections |
The password to access the FTP server. |
Root Directory | Root directory of the file connectorinstance. This is the path from where the file connectorinstance will store and read files on the FTP server or locally. |
Item
The item parameters that is needed to naming and formatting the files to read and write from:
Parameter | Description |
---|---|
Input template Only used when writing to a file
|
This is the body of the document. When this item is triggered through a mapping, it will write the value to the document.
Now each time a mapping to this item is triggered, we will write a payload containing this data. We are using SIA scripting variables here, which are documented here |
Filename | Writing: The name of the file you wish to create Reading: The name of the file you wish to read The filename is also what will define your file-type. Example: File1.csv - Creates a .csv file File2.txt - Creates a .txt file |
Prepend Only used when writing to a file |
The value of this parameter will be written as the very first input of the document. This value will not be written continuously This can be kept empty |
Seperator Only used when writing to a file |
This parameter will be the character used to separate the individual writings to the body. You can use any separator you want, but some common examples are: Space( ), comma(,), and semicolon(;) |
Appendix Only used when writing to a file |
The value of this parameter will be written as the very last input of the document. This value will not be written continuously This can be kept empty |
Upload Type Only used when writing to a file |
The upload type parameter is used to determine how a file is considered finished and then uploaded to the specified FTP server or stored locally. There are three different upload types: Data samples: Uploads when the specified amount of entries has been reached Time: Uploads when the specified amount of minutes has elapsed. File size: Uploads when the files has reached the specified size (in KB) |
Upload Parameter Only used when writing to a file |
Upload Parameter is used in correlation with the Upload Type Data samples: The number of entries into the file Time: The amount of minutes before the files is finished File size: The size of the file in KB |
File Directory | File Directory parameter determine the path where files are stored on the FTP server or locally. This path is in addition to the path specified in the Root folder (specified in the connector setup) The directory will look like this: Root folder + File Directory |
Additional information
INFO
The following section is specific to the FILE-connector, and does not apply to any other connectors
If a read from a file is desired to triggered by a mapping instead of by an interval then do the following:
- Set the Read write value in item of interest to Read and Write.
- In the field Input template or Custom value write "TRIGGER_READ" or “READ”
This will make it possible to trigger a read of a file dependent on a mapping without triggering a write.