Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Home
  • Knowledge base
  • Contact Us
  • Home
  • Connectors
  • File

File - Instance & item setup

How to setup a File instance and item to write CSV, JSON, XML or other types of files

Written by Daniel Tøttrup

Updated at April 5th, 2024

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Installation & Technical information
    Introduction SIA Connect Standalone SIA Connect ANY-Ware Cellular & WiFi connectivity
  • Configuration in the Web UI
    Getting started with the UI Connectors Instances Items Mapping Data System Network Tools & Add-ons DigiCert IoT Trust Manager
  • Connectors
    Siemens S7 Azure IoT Ethernet/IP Mitsubishi MELSEC OPC-UA Server SQL MQTT Omron Host Link REST API Omron FINS Keyence Beckhoff TwinCAT BACnet Virtual OPC-UA Client MS SQL File M-Bus Modbus
  • Scripting & Variables
    Data formatting
  • Developers
    API documentation Shadow API
  • Tutorials & Guides
    InfluxDB AWS IoT Core - Amazon Web Services Microsoft Power BI KaaIoT Siemens S7 AVEVA Insight SIA Connect Demo Rack Grafana Azure
  • General
+ More

Table of Contents

Instance Item Additional information INFO Additional internal information

 

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.
Depending on your desired format, this can look differently.
Example where we write to a .json file:
 

{
"Item name":"%ITEM.NAME%",
"Value" : %VALUE%
}

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. 

 

 

 

record documentation

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • Bulking multiple data items into a JSON message

0
0
Expand