Reducing Unnecessary Tags


I’m trying to reduce the number of unused/junk tags in our IO gateway (tag browser), but I’m not sure which tags are currently being used within screens.

I was extracting the tags from the screen XML’s but I’m not sure if all the tags within a screen show up in the XML. I’m using xml to find the strings and checking if the string has backslashes

Very low level example below with details missing

import xml.etree.ElementTree as ET
from xml.etree import ElementTree

tree = ET.ElementTree(ET.fromstring(input))
root = tree.getroot()

items = root.findall(".//str")
for item in items:
    if(item.text is not None and "/" in item.text and '"' not in item.text):
  1. Is there an efficient programmatic way for me to get all the XMLs for a project instead of me copying and pasting into a text box? There are way too many screens for me to do that

  2. Is there any way to extract all the tags used within project screens?

Thank you so much!!

You can export your tags by selecting them in the tag browser, right clicking and clicking “Export Tags”:
That will give you either a json or xml document which you can then parse through:

<Tags MinVersion="8.0.0" locale="en_US">
   <Tag name="Refresh_Query_Tags" type="AtomicTag">
      <Property name="valueSource">memory</Property>
      <Property name="dataType">6</Property>
      <Property name="documentation">Put this value in database queries (WHERE {[~]/Refresh_Query_tags} = {[~]/Refresh_Query_tags}) to force an update on those bindings when this value is changed.</Property>
      <Property name="tooltip">Toggle to update database connections</Property>
      <Property name="value">false</Property>

You can export any and all parts of a project via the same method. You’ll have to play around with it and do some cross referencing to accomplish what you’re trying for here. In hindsight, I’d say this is a problem easier prevented than fixed.

To your second question, no, but it’s in the works! You can upvote the tag finding feature on the features and ideas page here:
Tags Cross Reference | Voters | Inductive Automation

Thanks @Brandon_Peterson for the input

“You can export any and all parts of a project via the same method” - can you bulk export screens the same way or through a script. I only see copy XML for single screens

Is FileExport... what you’re looking for? That will pull a menu up where you can select as many project resources as you want, including screens.

It’s possible to find tags directly used on pages, but it’s very difficult to find dynamically referenced tags. For my projects, the vast majority of bindings I use are indirect…