Exporting and Importing Tags
Importing and Exporting Tags
Watch the videoIgnition can export and import tag configurations to and from the JSON (JavaScript Object Notation) format. You can import XML (Extensible Markup Language) or CSV (Comma Separated Value) file formats as well, but Ignition will convert them to JSON format while in a Tag Provider. Tag export files can be edited directly in any text editor, allowing you to make bulk edits to tags before importing them back into a Tag Provider.
Export Tags​
You can export tags in the Designer Tag Browser by selecting the Tags tab to export all your tags or selecting an individual folder that contains tags you want to export. You can even export individual tags as long the individual tags are in the same folder.
If you select a UDT instance to export, the UDT definition is not automatically included. You must export the definition as a separate file by clicking on the UDT Definitions tab.
When later importing these UDTs, it is recommended to import UDT definitions before importing any instances.
- On the Tag Browser toolbar, click the More Options menu to open the dropdown. Select Export Tags.
- Specify the folder you want to save your exported tag files in the Save window, and then click Save. Ignition will export tags by default to a .json file.
Import Tags​
You can import tags to an individual folder or under the Tags tab. When importing tags, you need to set the Collision Policy to tell Ignition how to handle duplicate tags. If any of the tags being imported already exist in the folder you specify, Ignition can abort the import, overwrite the tags, rename them, ignore them, or merge them.
Collision Policy | Description |
---|---|
Abort | Aborts the import if duplicate tags are found. |
Overwrite | Overwrites any tags in the folder that have the same name as tags being imported. Note this a complete overwrite of the tag. Changed in 8.1.8 As of 8.1.8, importing UDT definitions with this collision policy will remove any members that are not included in the import file. |
Rename | Renames any duplicate tags. |
Ignore | Ignores duplicate tags and imports only those that are unique. |
MergeOverwrite | Overwrites the tag with the exception of any properties that aren't defined in the import folder. Those properties will be merged. |
To import tags:
In the Tag Browser toolbar, right-click an existing folder and select Import Tags > Direct.
- Changed in 8.1.15The Direct and Interactive options were added in 8.1.15. The Import Tags option is the only selection that needs to be clicked for versions prior to 8.1.15.
Specify the folder you want to import your tags from and choose a previously exported file, either .json , .xml , or .csv file type.
Choose a Collision Policy.
Click Open to import the tags.
The tags now appear in the Tag Browser.
Interactive Tag Import​
The Interactive tag import option opens the Advanced Tag Import tool, which allows users to edit tag properties in the Designer before import. It combines the functionality of the basic Import Tags tool with the Tag Editor window.
Interface Element | Description |
---|---|
Adds the selected tag, folder, or UDT to the Staging Area. | |
Adds all tags, folders, and UDTs in the Selection Pane to the Staging Area. | |
Creates a new folder or tag at the selected node in the Staging Area, or the root if a node is not selected. | |
Opens a Tag Editor window for the selected tag or UDT. | |
Deletes the selected tag or UDT from the Staging Area. |
From the Tag Browser, click the More Options menu (or right-click on a folder) and select Import Tags > Interactive.
Select the .json, .xml, or .csv file to import.
Move the desired tags and UDTs from the Selection Pane to the Staging Area using the Add or Add All options.
Edit tags in the Staging Area by selecting a tag and clicking Edit
If any collisions are detected, you will be prompted to select a Collision Policy from the dropdown menu.
noteUnlike the basic Import Tags tool, you may only choose to Overwrite or Ignore duplicate tags imported via the Advanced Tag Import tool.
Click OK to import the tags and UDTs
The tags will now appear in the Tag Browser.
If your tags are not appearing as expected for a large tag import, the Designer's memory allocation may need to be increased. Access your Gateway and navigate to the Config > Gateway Settings > Designer Memory to adjust memory limitations. The default size is 1.0 GB, with available dropdown options from MB128 to 4.0 GB.
System Tag Alarms and Configurations​
Unlike regular tags, you cannot use the Tag Browser's built-in export and import tool for System Tags. You can instead use scripting to export and import the exported System Tags' configurations on a different system. See the Exporting and Importing System Tag Alarms page for examples on how to do this.
Tag File Formats​
Tags can be imported from CSV, JSON, and XML. Tags can only be exported in XML or JSON. There are many configuration settings for tags than what is displayed in a JSON or XML export file. The tag export feature only exports the configuration properties that have been edited in at least one of the tags in the selected export folder. Therefore, to ensure the desired configuration setting is available in the export file, at least one tag within the selected export folder must have that configuration property changed
CSV Format​
Importing​
Ignition supports importing tags from a CSV format. Details of the format are below, if you expand "CSV Example Format". This format can contain tag types, OPC paths, and most tag properties. One difference between the CSV format and the XML and JSON format is that the CSV format does not include support for alarm configurations. Alarms can certainly be added to tags in the Ignition Designer after tags have been imported from CSV, but alarms cannot be defined directly in the CSV.
Below is an example of the legacy CSV format, which contains the following tag types, purely for demonstrative purposes:
- An OPC Tag
- A Folder
- An OPC Tag located in a folder
- A Derived Tag
- An Expression Tag
- A Memory Tag
- A Query Tag
Path,Name,Owner,TagType,DataType,Value,Enabled,AccessRights,OPCServer,OPCItemPath,ScanClass,DriverName,ScaleMode,RawLow,RawHigh,ScaledLow,ScaledHigh,ClampMode,ScaleFactor,Deadband,DeadbandMode,FormatString,EngUnit,EngLow,EngHigh,EngLimitMode,Tooltip,Documentation,ExpressionType,Expression,OPCWriteBackServer,OPCWriteBackItemPath,SQLBindingDatasource,HistoryEnabled,PrimaryHistoryProvider,HistoricalScanclass,HistoricalDeadband,HistoricalDeadbandMode,InterpolationMode,HistoryMaxAgeMode,HistoryMaxAge,HistoryTimestampSource,UDTParentType,PersistValue,SourceDataType,SourceTagPath,SQLBindingPollRate,Permissions
# version=1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,_types_,,6,2,,TRUE,Read_Write,,,Default,,0,0,100,0,10,0,0,1.00E-04,0,"#,##0.##",,0,100,0,,,0,,,,,FALSE,,Default Historical,0.01,0,3,0,1,0,,FALSE,,,,
,A Folder,,6,2,,TRUE,Read_Write,,,Default,,0,0,100,0,10,0,0,1.00E-04,0,"#,##0.##",,0,100,0,,,0,,,,,FALSE,,Default Historical,0.01,0,3,0,1,0,,FALSE,,,,
A Folder/,OPC in a folder,,0,2,,TRUE,Read_Write,,,Default,,0,0,100,0,10,0,0,1.00E-04,0,"#,##0.##",,0,100,0,,,0,,,,,FALSE,,Default Historical,0.01,0,3,0,1,0,,FALSE,,,,
,Derived Tag,,13,2,100,TRUE,Read_Write,,,Default,,0,0,100,0,10,0,0,1.00E-04,0,"#,##0.##",,0,100,0,,,0,,,,,FALSE,,Default Historical,0.01,0,3,0,1,0,,FALSE,,[~]Expression Tag,,
,Expression Tag,,1,2,100,TRUE,Read_Write,,,Default,,0,0,100,0,10,0,0,1.00E-04,0,"#,##0.##",,0,100,0,,,1,"//This is an expression
100",,,,FALSE,,Default Historical,0.01,0,3,0,1,0,,FALSE,,,,
,Memory Tag,,1,7,I'm a memory Tag,TRUE,Read_Write,,,Default,,0,0,100,0,10,0,0,1.00E-04,0,"#,##0.##",,0,100,0,,,0,,,,,FALSE,,Default Historical,0.01,0,3,0,1,0,,FALSE,,,,
,OPC Tag,,0,2,,TRUE,Read_Write,Ignition OPC-UA Server,[devicename]folder/path,Default,,0,0,100,0,10,0,0,1.00E-04,0,"#,##0.##",,0,100,0,,,0,,,,,FALSE,,Default Historical,0.01,0,3,0,1,0,,FALSE,,,,
,Query Tag,,1,2,,TRUE,Read_Write,,,Default,,0,0,100,0,10,0,0,1.00E-04,0,"#,##0.##",,0,100,0,,,2,"/*Some Query*/
SELECT 100",,,,FALSE,,Default Historical,0.01,0,3,0,1,0,,FALSE,,,,
Property Values in the CSV Import​
The following table shows the configuration property names and values contained in legacy CSV tag import files. Tags were overhauled in Ignition 8.0, so the properties listed here are not the same as tags export from an Ignition 8.0+ system. For modern tag properties, see the Tag Properties page.
Property Name | Type | |
---|---|---|
Value | varies | The value of the tag, dependent on the data type. |
Data Type | Int | The data type of the Tag. Possible values are:
|
Enabled | Boolean | Determines if the tag should be enabled or disabled upon import. |
Tagtype | Int | Determines the type of the tag. A value of one is a "DB Tag", which is either a Memory Tag, Query Tag, or Expression Tag, depending on the value of the ExpressionType field. Possible values are:
|
ExpressionType | Int | Used in conjunction when the TagType is set to 1 (DB Tag), otherwise this field is ignored. Possible values are:
|
AccessRights | Int | If custom, will be defined by a Permissions Tag. Possible values are:
|
OPCServer | String | The server against which to subscribe the data point. Only present for OPC Tags. |
OPCItemPath | String | Represents the OPC item path for the tag. Only present for OPC Tags. |
OPCWriteBackServer | String | The configured write back OPC server for expression Tags. |
OPCWriteBackItemPath | String | Represents an OPC item path on the configured write back server, in cases where expression tags are configured. |
ScaleMode | Int | If and how the Tag value will be scaled between the source, and what is reported for the Tag.
|
ScaleFactor | Float | A numerical value representing the scale factor |
RawLow | Float | A numerical value representing the raw low value. Only used when ScaleMode is set to Linear or Square Root. |
RawHigh | Float | A numerical value representing the raw high value. Only used when ScaleMode is set to Linear or Square Root. |
ScaledLow | Float | A numerical value representing the scaled low value. Only used when ScaleMode is set to Linear or Square Root. |
ScaledHigh | Float | A numerical value representing the scaled high value. Only used when ScaleMode is set to Linear or Square Root. |
ClampMode | Int | Which clamp mode to use. Possible values are:
|
Deadband | Float | A numerical value used to prevent unnecessary updates for Tags whose values change by small amounts. Setting to 0.0 disables the deadband mode functionality. |
DeadbandMode | Int | While Deadband is set to a non-zero value, determines which mode to use. Possible values are:
|
FormatString | String | How the value should be formatted when converted to a string (only applies to numerical data types). Uses # and 0 characters to describe the format. # : If the number in this position is non-zero, then do not show the position. Otherwise, show the number. Useful when you only want to show a decimal position if the value is non-zero. 0 : If the number in this position is non-zero, then show that number. Otherwise, show a zero. Useful to add leading and trailing zeros to a value. |
EngUnit | String | The engineering units of the tag. |
EngLow | Float | The lowest expected value of the tag. |
EngHigh | Float | The highest expected value of the tag. |
EngLimitMode | Int | Dictates how the engineering range should be enforced on the tag. If not "Off", the tag will change to bad quality ("limit exceeded"), when the value falls outside the specified range. Valid values are as follows:
|
Tooltip | String | The tooltip provides a hint to visual components as to what should be displayed when the user hovers their mouse cursor over the component that is being driven by the value of this tag. |
Documentation | String | A freeform text property for information about the tag. |
DriverName | String | The name of the driver. Only used by tags configured for Tag Driving Providers |
ScanClass | String | The export will only include the name of the ScanClass, not the configuration of the Scanclass itself. A Scanclass with the same name needs to already exist on the Gateway that the tags are being imported to, prior to importing them. |
HistoryEnabled | Boolean | Determines if the Tag Historian module should record values from this tag. |
PrimaryHistoryProvider | String | The history provider to use if storing history with the Tag Historian module. |
HistoricalDeadband | Float | A numerical value used to prevent unnecessary updates for tags whose values change by small amounts. Setting to 0.0 disables the HistoricalDeadbandMode functionality. |
HistoricalDeadbandMode | Int | While HistoricalDeadbandDeadband is set to a non-zero value, determines which mode to use. Possible values are:
|
HistoricalScanclass | String | The export will only include the name of the ScanClass, not the configuration of the Scanclass itself. A Scanclass with the same name needs to already exist on the Gateway that the tags are being imported to, prior to importing them. |
InterpolationMode | Int | How values are interpolated. 2 exists for backwards compatibility (and is equivalent to 1), but only 0 or 3 should be used in the future.
|
HistoryTimestampSource | Int | Possible values are:
|
HistoryMaxAgeMode | Int | Possible values are:
|
HistoryMaxAge | Int | Max cycles between storage. |
UDTParentType | String | The path to the parent UDT type. Used by sub-types and instances. |
Exporting​
Although Ignition can import tags from a CSV format, Ignition does not export tags to a CSV format. Since multiple alarms can be configured per tag, the XML or JSON formats provide a much better format to allow for the tree structures needed to fully represent Ignition tags.
JSON Example​
In this example, we exported three tags from the Motor UDT in JSON format.
Amps - Expression tag with an Alarm and History enabled HI SP - Memory tag which is bound to a parameter to an OPC tag HOA - OPC tag
JSON Export Format Example​
The following exported tag file is in JSON format. As you browse through the JSON file, you will see the tag properties and configuration settings for each of the three tags listed above. Descriptions on the various properties can be found on the Tag Properties page.
{
"tags": [
{
"opcItemPath": {
"bindType": "parameter",
"binding": "ns\u003d1;s\u003d[Dairy]_Meta:Overview/Motor {MotorNumber}/Amps"
},
"valueSource": "opc",
"historyProvider": "MySQL",
"alarms": [
{
"mode": "BelowValue",
"setpointA": 25.0,
"name": "Low Amps",
"priority": "Critical",
"displayPath": {
"bindType": "Expression",
"value": "Motor{MotorNumber}"
}
},
{
"mode": "AboveValue",
"name": "High Amps",
"priority": "Critical",
"setpointA": {
"bindType": "Expression",
"value": "{[.]HI SP}"
}
}
],
"name": "Amps",
"historyEnabled": true,
"tagType": "AtomicTag",
"opcServer": "Ignition OPC UA Server"
},
{
"valueSource": "memory",
"name": "HI SP",
"value": 90,
"tagType": "AtomicTag"
},
{
"opcItemPath": {
"bindType": "parameter",
"binding": "ns\u003d1;s\u003d[Dairy]_Meta:Overview/Motor {MotorNumber}/HOA"
},
"valueSource": "opc",
"name": "HOA",
"tagType": "AtomicTag",
"opcServer": "Ignition OPC UA Server"
}
]
}
XML Example​
In this example, we exported the same three tags from our Tag Browser, that were also used in the JSON example. As you browse through the XML file, you will see the tag properties and configuration settings for each of the same three tags. Descriptions on the various properties can be found on the Tag Properties page.
<Tags MinVersion="8.0.0" locale="en_US">
<Tag name="Amps" type="AtomicTag">
<Property name="opcItemPath" boundValueType="parameter">ns=1;s=[Dairy]_Meta:Overview/Motor {MotorNumber}/Amps</Property>
<Property name="valueSource">opc</Property>
<Property name="historyProvider" datatype="String">MySQL</Property>
<CompoundProperty name="alarms">
<PropertySet>
<Property name="mode">3</Property>
<Property name="setpointA">25</Property>
<Property name="name">Low Amps</Property>
<Property name="priority">4</Property>
<Property name="displayPath" bindtype="Expression">Motor{MotorNumber}</Property>
</PropertySet>
<PropertySet>
<Property name="mode">2</Property>
<Property name="name">High Amps</Property>
<Property name="priority">4</Property>
<Property name="setpointA" bindtype="Expression">{[.]HI SP}</Property>
</PropertySet>
</CompoundProperty>
<Property name="historyEnabled" datatype="Boolean">true</Property>
<Property name="opcServer">Ignition OPC UA Server</Property>
</Tag>
<Tag name="HI SP" type="AtomicTag">
<Property name="valueSource">memory</Property>
<Property name="value">90</Property>
</Tag>
<Tag name="HOA" type="AtomicTag">
<Property name="opcItemPath" boundValueType="parameter">ns=1;s=[Dairy]_Meta:Overview/Motor {MotorNumber}/HOA</Property>
<Property name="valueSource">opc</Property>
<Property name="opcServer">Ignition OPC UA Server</Property>
</Tag>
</Tags>