Skip to main content
Version: 8.1

system.tag.browseHistoricalTags

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 result set.
  • .getReturnedSize() will get the number of records in the result set.
  • .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 result set 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​

TypeParameterDescription
StringpathThe Historical Tag Path to browse. See the Tag Export page for a description of how to construct a historical Tag.
List[String]nameFiltersA list of name filters to be applied to the result set. [optional]
IntegermaxSizeThe maximum size of the result set. [optional]
AnycontinuationPointSets the continuation point in order to continue a browse that was previously started and then limited. Use getContinuationPoint() on the Results object (see Returns below) to get the continuation 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, Vision Client, Perspective Session

Code Examples​

Example #1
# 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.
caution

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.

Example #2
# 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()

Keywords​

system tag browseHistoricalTags, tag.browseHistoricalTags