Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Scripting_function


New_in
Version8.1.19


Panel
titleDescription

Queries a Tag Provider to produce a list of tags that meet the specified criteria. Provides the same functionality as the Tag Report Tool. 

Client permissions restrictions


Panel
titleSyntax
Info

This function accepts keyword arguments.

system.tag.query([provider], [query], [limit], [continuation])

  • Parameters

String provider - The Tag Provider to query. Note: Technically this parameter is optional, but omitting it will result in an empty Results object. [optional]

PyObject query - An object that specifies the query conditions. Can be configured in the Tag Report Tool using the Copy as Script function. See example below.  [optional]

Integer limit - Maximum results to return. If more results are possible, the result will have a continuation point set. [optional]

String continuation- The Tag ID of a previously returned continuation point, to continue the associated query from that point [optional]


  • Returns

Results - A Results object which contains a list of Tag dictionaries, one for each Tag found during the browse. See Scripting Object Reference.

  • Scope

Gateway

Panel
titleCode Examples
Code Block
languagepy
titleCode Snippet
provider = 'Sample_Tags'
limit = 100

query = {
  "condition": {
    "path": "Ramp/Ramp*",
    "tagType": "AtomicTag",
    "attributes": {
      "values": [
        "alarm"
      ],
      "requireAll": True
    },
    "valueSource": "opc",
    "quality": "Error"
  },
  "returnProperties": [
    "path",
    "tagType",
    "quality"
  ]
}

# Limited to 100 rows. Use continuationPointcontinuation functionality to continue from last result, 
# or remove limit for full results.
results = system.tag.query(provider, query, limit)
for result in results:
	print(resultsresult)


# To continue from last result, use continuationPointcontinuation
 # Note: The query is stored on the gateway, and therefore does not need to be sent again. 
# A query parameter will be ignored if continuation is specified.  
results = system.tag.query(continuation=results.continuationPoint)
for result in results:
    print(resultsresult)  
Panel
titleKeywords

system tag query, tag.query