Versions Compared

Key

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

New_in
Version7.9.2

 

Panel
titleDescription

Browses a folder path or UDT and returns Tag configuration information for each Tag in the foldernode. This can be used to view event scripts, alarms, as well as any other configurable attribute on a Tag. 

Panel
titleSyntax

 system.tag.browseConfiguration(path, recursive)

  • Parameters 

String path - The path that will be browsed. The path typically leads to a folder or UDT instance. Leave blank to browse the root folder. A Tag Provider may be specified as follows: "[TagProvider]". If the Tag Provider is omitted, client scoped calls will be made against the project's default provider. Gateway scoped calls must include a Tag Provider.

Boolean recursive - If true, will recursively search for Tags in folders. Each folder will return a 'tags' property containing the nested TagConfigurations in another list. 

  • Returns

 TagConfiguration[] - A list of TagConfiguration objects. Attributes on the object may be read by calling get("propertyName"). A list of attributes with configuration information can be obtained by calling getProperties(). Only attributes with non-default values will appear in the attribute list. 

  • Scope

All

Warning

If called in the gateway scope, a tag provider must be specified.

TagConfiguration Method Summary

list of
MethodDescription
get(str propName)General purpose get method. Returns the value of propName
getAlarms()

 

getFolderPath()Returns the path to the folder the Tag resides in.
getFullPath()Returns the Tag path.
getName()Returns the name of the Tag.
getParameters() 
getProperties()Returns a  Java Hashmap of properties that have non-default values.
getSubTags() 
getTagType() 
Panel
titleCode Examples
Code Block
languagepy
titleCode Example Snippet - Print Attributes From All Tags
 """
This example will browse the root of the Tag Provider named "default". 
For each tag found, prints the non-default attributesproperties. 
"""

#Specify the folder to browse. Modify this line to filter on a specific folder.  
folderPath = "[default]"

#Start a non-recursive browse, and stores the configuration data in a variable 
tagConfig = system.tag.browseConfiguration(folderPath, False)

#Iterate through the configuration data
for tag in tagConfig:
	
	#For each tag, retrieve a list of non-default attributesproperties. We check each iteration of tagConfig
	#because each tag can potentially have a different configuration
	propList = tag.getProperties() 
	
	#Iterate through the list of properties
	for prop in propList:

		#Print the attributeproperty name and value. 
		print "Attribute Property'%s' has a value of '%s'" % (prop, tag.get(prop))
Code Block
languagepy
titleCode Snippet
#Browse for all tags at the root of the tag provider named 'default'
#Does some other cool stuff. Play with it more. 
configs = system.tag.browseConfiguration("[default]", False)
for item in configs:
	if str(item.tagType) == "Folder":
		for tag in item.subTags:
			print "Name: " + tag.name + ", Type: " + str(tag.tagType)
	else:
		print "Name: " + item.name + ", Type: " + str(item.tagType)