New Feature - Tag Report Tool

When copying out the script, we are including a qualified value rather than just the value itself. I am going to submit a bug for this, but the following should work every time:

provider = 'default'
limit = 100

query = {
  "options": {
    "includeUdtMembers": True,
    "includeUdtDefinitions": False
  },
  "condition": {
    "attributes": {
      "values": [],
      "requireAll": True
    },
    "properties": {
      "op": "Or",
      "conditions": [
        {
          "op": "And",
          "conditions": [
            {
              "prop": "name",
              "comp": "Equal",
              "value": "MyTagName"
            },
            {
              "prop": "value",
              "comp": "Equal",
              "value": "1"
            }
          ]
        }
      ]
    }
  },
  "returnProperties": [
    "tagType",
    "quality"
  ]
}

results = system.tag.query(provider, query, limit)

That doesn't work. I will contact support so they can take a closer look. Thanks for the help @ggross

If you have a non-production Gateway, any chance you can try the latest Ignition nightly? The issue I noted looks to have been fixed last week and there were a couple of other changes around value searching.

Garth

I can either try the nightly, or just wait until the stable release and try. I will hold off on contacting support until one of those happens. Thanks @ggross .

25 posts were split to a new topic: Json Diffing Discussion

Finally started playing with this, and decided it was powerful enough to start the migration away from my legacy tools (script libraries which output similar results) over to Tag Report Tool (via script). Wish this available long ago! Big fan!

Two issues I'm seeing initially:

  1. When operating from screen with limited resolution (docked laptop), the Tag Report Tool window appears on a different display and extends beyond what's available on that display - the top & bottom of the window are both off-screen. I first need to resize the window in the x-direction (which relocates the top of the window to top of my screen), then resize the top of the window and drag until window is within bounds of my screen, then move it over to the same screen as my Designer.

  2. Any way to get the Path (not the Full Path) property from system.tag.query()?
    Posting here because from the tag report tool, I can add results columns for both Path & Full Path:

Then, can copy the query to JSON and see the properties in the results (in this example, to get all UDT types of a provider):

{
  "query": {
    "options": {
      "includeUdtMembers": true,
      "includeUdtDefinitions": true
    },
    "condition": {
      "path": "_types_*",
      "tagType": "UdtType",
      "attributes": {
        "values": [],
        "requireAll": true
      }
    },
    "returnProperties": [
      "name"
    ]
  },
  "columns": [
    {
      "alias": "",
      "key": "name",
      "type": "property",
      "visible": true,
      "width": 122
    },
    {
      "alias": "",
      "key": "path",
      "type": "property",
      "visible": true,
      "width": 243
    },
    {
      "alias": "",
      "key": "fullpath",
      "type": "property",
      "visible": true,
      "width": 243
    }
  ]
}

Results are as expected, with 'Relative Path' in one column, 'Full Path' in another. However, "Copy as Script" and executing from Script Console appears to return only the fullPath property. I've attempted to add the 'path' as a return parameter (see below) to no avail.

query = {
  "options": {
    "includeUdtMembers": True,
    "includeUdtDefinitions": True
  },
  "condition": {
    "path": "_types_*",
    "tagType": "UdtType",
    "attributes": {
      "values": [],
      "requireAll": True
    }
  },
  "returnProperties": [
    "name",
    "path"
  ]
}

A print of all keys in the first return object shows there is only the 'fullPath' property, and the 'path' property is omitted entirely.
Sure, it's easy enough to strip the "[provider]" off of the full path for each result but hoping to avoid the extra processing if this property is readily available.

1 Like

The fullPath of the results is an object that has a number of different options for returning the path in different formats:

.toString(): Full Path
.toStringFull(): Same as .toString()
.toStringPartial(): Path without provider

if you take the default query that is copied from the Tag Report Tool, you should be able to run the following to get the path without the provider:

print(results[0]['fullPath'].toStringPartial())

Keep in mind when doing comparisons with the path (should you need to do it) that fullPath is a BasicTagPath object and would need to be cast to a String for most use cases.

Garth

I do this programmatically in my Exchange utility with the .toStringPartial() method of the fullPath TagPath object.

Thank you for the insight! I'm ashamed I didn't look into the details of the returned object previously :man_facepalming:. I was converting to string, then back to TagPath using:

from com.inductiveautomation.ignition.common.tags.paths.parser import TagPathParser
fullPath = str(results[0]['fullPath']) # "[provider]path/to/tag"
partialPath = TagPathParser.parseSafe(fullPath).toStringPartial() # "path/to/tag"

Any insight on the issue of window resolution w.r.t. screen resolution?

The window sizing issue is just a Java Swing/frame packing problem. The default size the report tool window assumes is too large, but Swing doesn't detect that and resize it until you trigger a notification by resizing the window horizontally. Not a ton to be done about it unfortunately.

I'm unsure if this would be considered a bug, but while trying to query for all UDTs which have Parent Data Types, I'm seeing some curious results when adding the desired property condition (Query as JSON for each in details):

Parent Data Type : Has
{
  "query": {
    "options": {
      "includeUdtMembers": true,
      "includeUdtDefinitions": true
    },
    "condition": {
      "path": "_types_*",
      "attributes": {
        "values": [],
        "requireAll": true
      },
      "properties": {
        "op": "Or",
        "conditions": [
          {
            "op": "And",
            "conditions": [
              {
                "prop": "typeId",
                "comp": "Defined"
              }
            ]
          }
        ]
      }
    },
    "returnProperties": [
      "tagType"
    ]
  },
  "columns": [
    {
      "alias": "",
      "key": "path",
      "type": "property",
      "visible": true,
      "width": 403
    },
    {
      "alias": "",
      "key": "tagType",
      "type": "property",
      "visible": true,
      "width": 301
    }
  ]
}

vs

Parent Data Type : != : (Field after '!=' intentionally left blank)
{
  "query": {
    "options": {
      "includeUdtMembers": true,
      "includeUdtDefinitions": true
    },
    "condition": {
      "path": "_types_*",
      "attributes": {
        "values": [],
        "requireAll": true
      },
      "properties": {
        "op": "Or",
        "conditions": [
          {
            "op": "And",
            "conditions": [
              {
                "prop": "typeId",
                "comp": "NotEqual",
                "value": ""
              }
            ]
          }
        ]
      }
    },
    "returnProperties": [
      "tagType"
    ]
  },
  "columns": [
    {
      "alias": "",
      "key": "path",
      "type": "property",
      "visible": true,
      "width": 403
    },
    {
      "alias": "",
      "key": "tagType",
      "type": "property",
      "visible": true,
      "width": 301
    }
  ]
}

The first query appears to show several more results than the latter, including several UDTs which have <None> selected in the drop down next to Parent Data Type, though not all UDTs matching this config show up in the results. Perhaps some of these UDTs had a Parent Data Type selected in the past?
Edit: Add escape character "\" before "<" and ">" around None.

While configuring Tag Report, clicking on Ancestor drop-down does NOT populate list of types when clicking directly on the down-arrow. Anything outside of the red area I outlined in the below snip appears to work correctly.

This is exactly what is happening. has is looking for any Tag definition that has the property as part of the definition. Once a property is set in a tag, even if it is cleared or matches a default value the key will persist as part of the tag definition forevermore. It isn't ideal, and we have had discussions about cleaning things like this up; but it isn't something that we are looking to do anytime in the future.

This is an issue that has been logged internally for a while now [internal ID IGN-6946]. I am adding this comment to the ticket so that it adds another data point to people affected by the issue.

Garth

2 Likes

Sorry for the off-topic, would you mind sharing what software you use for internal ticketing at Ignition? It seems to be very effective.

We use YouTrack from JetBrains.

2 Likes