Keeping Tags Organized

It is important to give Tags a meaningful structure (you can also rename the Tags independent of their Item Path) and arrange them in hierarchical tag folders so that they are easy to understand and identify for all developers.

Tag Name Rules

The best way to keep your tags organized is to rename them with something meaningful. By default, Ignition Tags are named after their OPC Server address when a tag is dragged into the Tag Browser. You can change this to just about anything that you want. We recommend using names that mean something to you process like 'Motor 3 Amps' or creating folders in your Tag Browser like 'Motor 3/Amps'. When renaming Tags and folders, there is really only question to ask: does this structure make sense?

When you choose a new name for your Tags and Folders, there are some reserved characters that you cannot use. There are many special characters that are available to use when naming tags, but we recommend using only alphanumeric characters (A-Z, a-z, 0-9) and spaces. There are many characters that are not allowed, here are a few that are commonly tried. These have special significance in the Tag's path so they aren't valid in a name.

Invalid Tag Name characters

.

period

~

tilda

/

forward slash

\

back slash

[ ]

square brackets

{ }

braces

One noticeable exception is the parentheses "(" and ")" are missing from this list. Technically they are valid for Tag names, but we do not recommend that you ever use them because it tends to cause confusion. When displaying information in a client, use them as much as you'd like but they shouldn't be a part of a Tag or Folder name.

Tag Paths

Tags and their properties can be referenced by a string-based path. Each tag has a unique absolute path and often has many equivalent relative paths when referenced from other tags. You most often generate these paths by browsing or through dragging. However, it's a good idea to understand how tag paths work, particularly if you get into indirect tag binding or scripting.

A tag path looks something like this: [Tag Provider]folder/path/tag.property

The folder/path/tag.property portion of the path may contain the following:

  • A tag

  • Any number of nested folders followed by a tag, separated by forward slashes (/).

  • A period (.) followed by a property name after the tag. Omitting this is equivalent to using the .Value property.

The [Source] portion surrounded by square braces can have the following options:

Source Option
Meaning
Applicability

[Tag Provider Name]

The name of the tag provider that hosts the tag.

OPC, Expression tags

[] or not specified

The default tag provider for the current project.

OPC, Expression tags

[.]

Relative to the folder of the tag that is being bound.

Expression, Client tags

[~]

Relative to the tag provider of the tag that is being bound (root node).

Expression, Client tags

[Client]

Refers to a client tag.

Client

[System]

Refers to a system tag.

System

Using Relative Paths

Paths that begin with [.] or [~] are known as relative paths. They are used inside Tags that bind to other tags, and are relative to the host tag's path. Using the relative path syntax helps to avoid problems caused by moving tags and renaming providers.

[.] refers to the tag's current folder. By using [.], tags can be moved from folder to folder without problem (provided that all of the applicable tags are moved together). Additionally, you can use . . to go back one folder from the current relative position, for example [~]../../tag allows you to reference a tag two folders up.

[~] refers to the tag's provider root. It can replace the explicit provider name, and thus protect against provider renames and importing/exporting/moving tags between different providers.

Tag Path Manipulation

Ignition provides a great deal of flexibility for tag addressing since tag paths and tag properties are string-based. The underlying strings that compose a valid tag path can be assembled from many different parts in with the eventual construction resulting in a valid tag path.

The following scripting demonstrates this concept. Suppose there was a tag path to a level indicator in a tank. In this case it is the default tag provider, Tanks folder, Tank 1 Folder, and the Level tag.

tagPath = "[default]Tanks/Tank 1/Level"
But suppose that there was more than just Tank 1 and instead there was Tank 2, Tank 3, Tank 4, etc. Dynamically changing the tag paths is simple with Ignition's tag paths being nothing more than string representations. The following takes the tank number and inserts it into a new tag path. The tankNumber variable changes the eventual creation of the tagPath.
tankNumber = 2
tagPath = "[default]Tanks/Tank %i/Level" % tankNumber

The result of the tagPath variable will be [default]Tanks/Tank 2/Level which is a valid tag path to the the level sensor for Tank 2.

Similar Topics ...