With Tagging Scripts you can build a Calculated tag based on the parts of the full Heirarchical Tagname
The script is a Visual Basic so you can use complex expressions, using Program Logic such as Case Statements, string functions etc
Tagging Scripts return the CalcTag in the script
You can refer to the parts of each level of the full Heirarchical Tagname
FirstTag - the Top level tag
LastTag - the bottom level tag
RootTag - the lowest level tag part whose class is a number root
RootPrefix - The letters before any number in the RootTag
RootNum - The number in the RootTag
TagPart# TagPrefix# TagNum# work similarly where # is the level in the heirarchy with 0 at the lowest level.
Similarly you can use the captions and classes of the object hierarchy
You can also get the name of the parent Instance Real or External tags using ParentRealTag and ParentExtTag
There is also a calculation editor that shows when you click the button in Custom Tagging.
This provides drag and drop for tag parts and a small collection of function - but you can use any VBS code.
Tagging Scripts can include the current value so you can leave existing values unchanged using
IF CurrentTagValue ="" THEN
'code for new entries
CalcTag = CurrentTagValue