Skip to end of metadata
Go to start of metadata

This function is used in Python Scripting.

Description

Will browse for any historical Tags at the provided historical path. It will only browse for Tags at the path, and will not go down through any children. Will return with a BrowseResults object, which can be accessed using the methods below:

  • .getResults() will get the underlying resultset.
  • .getReturnedSize() will get the number of records in the resultset.
  • .getContinuationPoint() will get the continuation point if this function was limited, allowing you to use it in another function call to continue the browse.

The resultset returned from .getResults() is a list of Results objects. This list can be iterated through with a standard for loop, and each object in the list can be accessed with the following methods:

  • .getPath() will get the full Historical Tag Path for that object.
  • .getType() will get the type of the object.
  • .hasChildren() a flag indicating whether or not the object has any children.
Client Permission Restrictions

This scripting function has no Client Permission restrictions.

Syntax

system.tag.browseHistoricalTags(path, nameFilters, maxSize, continuationPoint)

  • Parameters

String path - The Historical Tag Path to browse. See the Tag Export page for a description of how to construct a historical Tag Path.

String[] nameFilters - A list of name filters to be applied to the result set.

Integer maxSize - The maximum size of the result set.

Object continuationPoint - Sets the continuation point in order to continue a browse that was previously started and then limited. Use .getContinuationPoint() on the BrowseResults object to get the continuation point.

  • Returns

BrowseResults - An object that contains the results as well as the Continuation Point. Get the results by calling .getResults() on the BrowseResults object.

  • Scope

All

Code Examples
# This script will browse for any history tags at the specified historical path and print out all of their Historical Tag Paths to the console.
 
path='histprov:DB:/drv:controller:default:/tag:simulator/turbine 3'
browse = system.tag.browseHistoricalTags(path) #We call the function and place the BrowseResults that get returned into a variable called browse.
results = browse.getResults() #We can then call getResults() on the BrowseResults variable, and store that in a variable called results.
for result in results: #We can now loop through the results in a for loop.
	print result.getPath() #We then call .getPath() on the individual objects to get the Tag Path.

The following script can be very dangerous, as it recursively calls itself until there are no more children. If you have a lot of Historical Tags and provide it with a path that is to something on the top level, it could take a long time and even lock up your system.

# This script will browse for Historical Tags and print their Historical Tag Path to the console, starting from the specified path,
# and going all the way down until there are no more children.
# This is useful because the function by itself will only provide results that are located at the specified path, but not for anything further in.
# This function recursively calls itself if there are any results that still have children.
# So if the specified path has any folders, the function will browse those as well until it can't browse any further.
# If you have a lot of Historical Tags and do not specify a path in the function, it will browse for all of your Historical Tags,
# which could take some time and may lock up your system. It is recommended to specify some sort of path.
 
def browse(path='histprov:DB:/drv:controller:default:/tag:simulator'):
	for result in system.tag.browseHistoricalTags(path).getResults():
		print result.getPath()
		if result.hasChildren():
			browse(result.getPath())
browse()
  • No labels