Skip to main content
Version: 8.1

Exporting and Importing System Tag Configurations

There may be instances where you want to export the configuration of a System Tag. Unlike regular tags from a Tag Provider however, the built-in import and export functionality is disabled for System Tags.

System Tag Import and Export Functions Disabled

As a result, we will use both scripting and system functions to import or export the configurations we want. In each of the examples below, we have configured a single alarm on the LicenseState tag that we want to export and import to another Gateway, located in the Tag Browser under [System] > Gateway > LicenseState.

LicenseState Alarm in Tag Browser

Exporting System Tag Configurations​

Exporting Tags in the System Provider​

This section demonstrates how to export configurations for all the System Tags in the System Provider. For an example on exporting a specific System Tag's configuration, see the Exporting a Targeted System Tag section.

  1. Open the Script Console in the Ignition Designer.

    Script Console Location in Menubar

  2. Use the system.tag.exportTags() function to export your System Tags. We can use the following script, replacing the filePath parameter with the filePath you want to export to:

    Export System Tags Script
    filePath = "C:\\Users\\bau\\Desktop\\mySystemTags\\allSystemTags.json"
    tagPaths = ["[System]"]

    system.tag.exportTags(filePath, tagPaths)

    Export All System Tag Configurations Script

  3. You should now have a file containing your tags in JSON called allSystemTags.json, located at the specified file path.

Exporting a Targeted System Tag​

Alternatively, you can export a single targeted System Tag or group of System Tags. In the example below, we will export the LicenseState tag only, since this is the only System Tag that has the alarm we want.

  1. Open the Script Console in the Ignition Designer.

    Script Console Location in Menubar

  2. Use the system.tag.exportTags() function to export the LicenseState System Tag. We can use the following script, replacing the filePath parameter with the filePath you want to export to:

    Export LicenseState Tag Script
    filePath = "C:\\Users\\bau\\Desktop\\mySystemTags\\targetedSystemTag.json"
    tagPaths = ["[System]Gateway/LicenseState"]

    system.tag.exportTags(filePath, tagPaths)

    Export Targeted System Tag Configuration Script

  3. You should now have a file containing the LicenseState tag in JSON called targetedSystemTag.json, located at the specified file path.

Importing System Tag Configurations​

Importing Tags from the System Provider​

The steps below demonstrate how to import configurations for all the System Tags in the System Provider. In this section, we are assuming the allSystemTags.json file from the Exporting Tags in the System Provider example is accessible locally on the system importing the System Tag configurations, and inside a folder called mySystemTags. For an example on importing a specific System Tag's configuration, see the Importing a Targeted System Tag section.

  1. Open the Script Console in the Ignition Designer.

    Script Console Location in Menubar

  2. Use the system.tag.configure() function to import the allSystemTags.json file. We can use the following script, replacing the filePath parameter with the path your .json file is located at:

    Import allSystemTags.json File Script
    filePath = "C:\\Users\\bau\\Desktop\\mySystemTags\\allSystemTags.json"
    tags = system.file.readFileAsString(filePath)

    system.tag.configure("[System]", tags)

    Import All System Tag Configurations Script

  3. Your System Tags should now be updated with the imported System Tags' configurations.

    note

    You may receive an error saying [Bad_AccessDenied("Insufficient Tag Provider Edit Permissions")] after importing all your configurations. This is because the imported configurations may:

    1. Affect tags that do not exist
    2. Affect tags that are not in the same location as the export system
    3. Affect tags that cannot be edited, or are in folders that cannot be edited

    The imported configurations should still affect the System Tags that are available and in the same directory.

Importing a Targeted System Tag​

The steps below demonstrate how to import configurations for a single, targeted System Tag. In this section, we are assuming the targetedSystemTag.json file from the Exporting a Targeted System Tag example is accessible locally on the system importing the System Tag configuration, and inside a folder called mySystemTags.

  1. Open the Script Console in the Ignition Designer.

    Script Console Location in Menubar

  2. Use the system.tag.configure() function to import the targetedSystemTag.json file. We can use the following script, replacing the filePath parameter with the path your .json file is located at:

    Import targetedSystemTag.json File Script
    filePath = "C:\\Users\\bau\\Desktop\\mySystemTags\\targetedSystemTag.json"
    tags = system.file.readFileAsString(filePath)

    # Note that unlike the previous example where we imported all the System Tags to the [System] provider,
    # we need to specify the exact directory where our targeted tag lives.
    system.tag.configure("[System]Gateway", tags)

    Import Targeted System Tag Configuration Script

  3. The specified System Tag should now be updated with the imported System Tag's configurations.