Templates

<< Click to Display Table of Contents >>

 

Templates

Templates are INI files used to configure both import and export tools. They inform, for example, which type of separator is used in a CSV file, whether object Links can be exported, etc. INI files have the following format:

Rows starting with a semicolon are comments, and are not considered when interpreting a file

This file is organized in sections, and each section contains one or more variables. Sections are identified by names inside brackets. Variables are all words before an equal sign. A section cannot contain two variables with the same name

Blank rows are ignored

 

An example of an INI file is displayed next.

; First section
[SECTION1]
Var1=0
Var2=1
; Second section
[SECTION2]
Var1=TRUE
Var3=FALSE

 

This format is a text that can be easily altered by users, and they can generate a new template by using a regular text editor. The same template can be used both for importing and exporting objects.

E3 templates allow users to redefine values for columns in a CSV file, as well as for object types. In addition, they also allow users to group more than one property in the same column. This is all performed by defining identifiers, which are keywords used in a CSV file, and linked to properties or object classes in an INI file.

In E3, these templates for this import and export tool are defined with the following sections and variables:

Sections defined for Templates

Section

Description

Header

Defines the identifiers allowed for column names and data types. This section must define the header and types variables. NOTE: This is a mandatory section for export

Configuration

Defines additional configurations for this import or export tool. This section must define the separator, root, link, collection, objectduplicated, and bindduplicated variables

Types

Creates a relationship between data type identifiers and real object classes. Each identifier listed on the types variable that is not equal to an object's class name must be documented in this section, and a variable must be created for each identifier

Columns

Creates a relationship between column name identifiers and property names. Each identifier listed on the header variable that is not equal to a property name must be documented in this section, and a variable must be created for each identifier

Filter

Defines which object classes must be imported or exported. This section must define one of these two variables: include or exclude. If both are defined, only include is considered

 

Variables defined for Templates

Section

Description

header

Defines a column order and identifiers to use. All columns of a CSV file must be listed, separated by commas. Each identifier that is not equal to a property name must be listed in section Columns, each one with a variable. NOTE: This is a mandatory variable for export

types

Defines identifiers for allowed data types in a CSV file. These identifiers must be listed in this variable, separated by commas. It is only necessary to define this variable if there is an identifier that is different from an object's class name. In this case, for each identifier, there must also have a variable in section Types

separator

Defines a separator to use for delimiting columns in a CSV file. In case this variable is not defined, a list separator configured in Windows is used

root

Defines whether a root object is exported or imported, along with its child objects. In case this variable is not defined, a root object is used

link

Defines whether object Links are exported or imported. In case this variable is not defined, Links are used

collection

Defines whether object collections are exported or imported. In case this variable is not defined, collections are used

objectduplicated

Defines what to do when a pre-existing object is imported. Possible values for this variable are 0 - askalways: Always asks what to do, 1 - changealways: Always changes all properties of the existing object, 2 - ignorealways: Always ignores the object being imported, or 3 - createalways: Always creates a new object, auto-incrementing its name. In case this variable is not defined, the askalways value is then applied. This option is not used in the export process

bindduplicated

Defines what to do when a pre-existing Link is imported. Possible values for this variable are 0 - askalways: Always asks what to do, 1 - changealways: Always replaces the existing Link by a new one, or 2 - ignorealways: Always ignores the Link being imported. In case this variable is not defined, the askalways value is then applied. This option is not used in the export process, nor does it have the createalways value. If used, it is always changed to askalways

collectionduplicated

Defines what to do when a pre-existing collection is being imported. Possible values for this variable are 0 - askalways: Always asks what to do, 1 - changealways: Always replaces the existing collection by a new one, or 2 - ignorealways: Always ignores the collection being imported. In case this variable is not defined, the askalways value is then applied. This option is not used in the export process, nor does it have the createalways value. If used, it is always changed to askalways

itemduplicated

Defines what to do when a pre-existing collection item is being imported. Possible values for this variable are 0 - askalways: Always asks what to do, 1 - changealways: Always changes all properties of the existing item, 2 - ignorealways: Always ignores the item being imported, or 3 - createalways: Always creates a new item, auto-incrementing its name. In case this variable is not defined, the askalways value is then applied. This option is not used in the export process

include

Defines which object classes must be imported or exported. This filter is not recursive, that is, if an object class that may have child objects is included, these child objects are not automatically included. It cannot be used along with the exclude variable. Only what is defined in this variable can be imported or exported

exclude

Defines which object classes must not be imported or exported. This filter is not recursive, that is, if an object class that may have child objects is excluded, these child objects are not automatically excluded. It cannot be used along with the include variable. Only what is defined in this variable can be imported or exported

 

NOTE

A semicolon character cannot be used as a full or partial name of a column, neither can it be used as a full or partial name for an identifier. This limitation is due to the fact that a semicolon defines a comment in an INI file. Thus, a variable created in either Columns or Types section to define an identifier that has a semicolon cannot be read correctly.

 

Example:

[Header]
header=ObjectType,Name,DocString,N1/B1,N2/B2,
N3/B3,N4/B4,Scan,AllowRead,AllowWrite
types=Tag,Block,Element
 
[Configuration]
separator=','
root=true
link=true
collection=true
objectduplicated=askalways
binddupplicated=askalways
collectionduplicated=askalways
itemduplicated=askalways
 
[Types]
Tag=IOTag
Block=IOBlock
Element=IOBlockElement
 
[Columns]
N1/B1=N1,B1
N2/B2=N2,B2
N3/B3=N3,B3
N4/B4=N4,B4
 
[Filter]
exclude=IOFolder

 

Elipse Software provides some templates for importing or exporting different object types. These templates can also be used as a basis to create others. Templates are on folder Templates of E3's installation path.

 

NOTE

On the import process, columns to use are read directly from a CSV file. On this particular case, there is no need for a header variable on a template. However, if any column is named using an identifier, this one must be defined on Columns section or this column is ignored.

Was this page useful?