Skip to main content
Version: 8.1

Exporting and Importing System Tag Configurations

There may be times when you want to export or import the configuration of a System tag. Unlike regular tags from a Tag Provider, the built-in import and export functions are disabled for System tags.

System Tag Import and Export Functions Disabled

Instead, you can use scripting functions to import or export the configurations you want. This is useful when migrating a Gateway to new hardware, backing up and restoring alarm configurations, or replicating settings across development, testing, and production environments.

Each example below uses a single alarm configured on the LicenseState tag, found in the Tag Browser under [System] > Gateway > LicenseState.

LicenseState Alarm in Tag Browser

Exporting System Tag Configurations​

Exporting Tags in the System Provider​

This example exports the configurations for all the System tags in the System provider. To export a single tag instead, see Exporting a Targeted System Tag.

  1. Open the Script Console in the Ignition Designer.

    Script Console Location in Menubar

  2. Use the system.tag.exportTags() function script below to export your System tags, replacing the filePath parameter with the path you want to export to:

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

    system.tag.exportTags(filePath, tagPaths)

    Export All System Tag Configurations Script

The export creates a JSON file named allSystemTags.json at the specified path.

Exporting a Targeted System Tag​

You can also export a single System tag or a group of tags. This example exports only the LicenseState tag.

  1. Open the Script Console in the Ignition Designer.

    Script Console Location in Menubar

  2. Use the system.tag.exportTags() function script below to export the LicenseState tag, replacing the filePath parameter with the path you want to export to:

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

    system.tag.exportTags(filePath, tagPaths)

    Export Targeted System Tag Configuration Script

The export creates a JSON file named targetedSystemTag.json at the specified path.

Importing System Tag Configurations​

Importing a configuration overwrites the existing settings on any matching System tags. The examples below use the JSON files created in the export examples, so make sure the file is accessible on the Gateway you are importing to.

Importing Tags from the System Provider​

This example imports the allSystemTags.json file from Exporting Tags in the System Provider. To import a single tag instead, see Importing a Targeted System Tag.

  1. Open the Script Console in the Ignition Designer.

    Script Console Location in Menubar

  2. Use the system.tag.configure() function script below to import the allSystemTags.json file, replacing the filePath parameter with the path to your .json file:

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

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

    Import All System Tag Configurations Script

Your System tags are now updated with the imported configurations.

note

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

  1. Do not exist
  2. Are not in the same location as the export system
  3. Cannot be edited, or are in folders that cannot be edited

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

Importing a Targeted System Tag​

This example imports the targetedSystemTag.json file from Exporting a Targeted System Tag.

  1. Open the Script Console in the Ignition Designer.

    Script Console Location in Menubar

  2. Use the system.tag.configure() function script below to import the targetedSystemTag.json file, replacing the filePath parameter with the path to your .json file:

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

    # Unlike the previous example where all the System tags were imported to the [System] provider,
    # you need to specify the exact directory where the targeted tag lives.
    system.tag.configure("[System]Gateway", tags)

    Import Targeted System Tag Configuration Script

The specified System tag is now updated with the imported configuration.