Import variables: CSV file structure

The import function in the data source configurator is, together with the export function, built to easily and effortlessly copy variables from one device to another. Additionally, you can use the import function to prepare variables in a CSV file and load them all at once into your configurator.

This article explains the structure of the CSV file and the syntax of the corresponding settings. Despite the fact that every protocol is structured in it’s own way (i.e. Siemens S7 works with Data Blocks and OPC-UA doesn’t) a uniform file structure is applied for all protocols.

How to: export and import variables

View any of the protocol-specific guides  about the actual steps of exporting and importing a CSV file.

CSV file structure

The structure of the CSV file needs to be correct for the import function to work properly. The headers (first row) of column 1-8 should look like this:

NameAddressTypeWidthSignedMax string lengthFactorUnit

Each column represents a different setting and these are all explained below. Easily navigate to the desired section by pressing the corresponding header above.

Tip: an easy template

You can quickly and easily create a template by first creating a single variable using the X4 remote interface and then exporting this variable to a CSV file.

Name

You can name the variables freely. It is advised to enter a very brief description of the variable (i.e. weight, temperature zone #1, emergency stop section B5).

Address

The address is protocol specific, since every protocol has its own structure, and is explained separately for the following protocols:

Siemens

On the X4 remote you can enter your variable’s region (DB, I, M, or Q) and address. If you have selected DB as region, you will see an additional field named “Data block“. The example table below shows how to list the addresses in the CSV file.

Online (X4 remote)Offline (CSV file)
RegionData blockAddressAddress
DB32.13.2.1
I 2.1I2.1
M 2.1M2.1
Q 2.1Q2.1

Address?

Unsure about what your variable’s address is or unable to find it? Have a look at our Siemens S7 data source article.

Modbus TCP/IP

On the X4 remote you can enter your variable’s function code (coils, discrete input, holding registers, or input registers) and address. The example table below shows how to list the addresses in the CSV file.

Online (X4 remote)Offline (CSV file)
Function codeAddressAddress
1 – Coils11.1
2 – Discrete input12.1
3 – Holding registers13.1
4 – Input registers14.1

OPC-UA

On the X4 remote you can enter your variable’s address, consisting of an identifier type, a namespace index, and an identifier. Both identifier types (string and numeric) require a different address when used in Cloud Logging and Alarming. The example table below shows how to list the addresses in the CSV file.

Online (X4 remote)Offline (CSV file)
Identifier typeNamespace indexIdentifierAddress
String220001ns=2;s=20001
Numeric220001ns=2;i=20001

Namespace index? Identifier?

Unsure about what your variable’s namespace index or identifier is? Have a look at our OPC-UA data source article.

BACnet/IP

On the X4 remote you can enter the variable’s object typeinstance, and a property. The object type and property also have a numeric identifier. For example, object type “analog_value” corresponds with numeric identifier “2”. These are determined by the BACnet/IP protocol itself, but can also have custom identifiers that are configured by the user. The example table below shows how to list the addresses in the CSV file.

Online (X4 remote)Offline (CSV file)
Object typeObject identifierObject propertyAddress
analog_value4present_value2.4.85

SMTP

On the X4 remote you can enter the data typeaction, and keywords. The table below shows examples of all possible actions.

Online (X4 remote)Offline (CSV file)
Data typeActionKeywordsAddress
StringReturn e-mail subjectHighSMTP::Keyw:High
Ptrn:Subject:
StringReturn e-mail bodyMediumSMTP::Keyw:Medium
StringSearch for text pattern: “Description”LowSMTP::Keyw:Low
Ptrn:Description

Digital input

On the X4 remote you can enter the data type and communication protocol. The example below shows how to list the x500 IoT gateway’s digital input in the CSV file.

Online (X4 remote)Offline (CSV file)
TypeProtocolTypeAddress
BooleanGPIOboolGPIO::

Data type (type, width & signed)

In the CSV file a variable’s data type is divided into 3 separate settings:

  • Type: bool, int, float, or string.
  • Width: is required when the type is an int or float. Available widths are 8, 16, 32, and 64 bits.
  • Signed: “TRUE” for data types that can be positive and negative (signed). “FALSE” for data types that can only be positive (unsigned).

This table explains the available data types and their corresponding notation in the CSV file.

Online (X4 remote)Offline (CSV file)
Data typeTypeWidthSigned
BOOLbool  
SINTint8TRUE
INTint16TRUE
DINTint32TRUE
LINTint64TRUE
USINTint8FALSE
UINTint16FALSE
UDINTint32FALSE
ULINTint64FALSE
REALfloat32 
LREALfloat64 
STRINGstr  

Max string length

A string data type requires its maximum amount of characters to be specified in the “Max string length” column. Leave this column empty when the data type is not a string.

Factor

You can multiply the value. This can be useful when you would like to measure grams in kilograms, for example. In this example you would set the factor to 0.001.

Unit

The unit of measurement (i.e. kg, liter, °C, bar) will be visible in dashboards to the right of each value.