Using Relative Tag Paths
Tag paths that begin with [.] or [~] are known as relative paths. They are used inside Tags that bind to other Tags, and they 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 ".." (two periods) to go back one folder from the current relative position, for example [.]../../tag allows you to reference a Tag that is two folders up.
[~] refers to the Tag's provider root. It replaces an explicit provider name and thus protects the Tag path from "breaking" if the provider is renamed or if the Tag is imported/exported/moved 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 which the eventual construction results 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 because Ignition's Tag paths are 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. Using this method in scripting or in an expression binding will look slightly different.
tankNumber = 2
tagPath = "[default]Tanks/Tank %i/Level" % tankNumber
tag("[default]Tanks/Tank "+{Root Container.tankNumber}+"/Level")
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.