Top  | Previous | Next

system.tag.browseTags

Description

Returns an array of tags from a specific folder. The function supports filtering and recursion. Leave filters blank to return all tags.

 

information2 This function accepts keyword-style invocation. See also: Functions / Keyword Invocation

Syntax

system.tag.browseTags(parentPath, tagPath, tagType, dataType, udtParentType, recursive, sort)

Parameters

String parentPath - The parent folder path. Leave blank for the root folder. Note: you can specify the tag provider name in square brackets at the beginning of the parentPath string. Example: "[myTagProvider]MyTagsFolder".If the tag provider name is left off then the tag will be added to the default internal provider named "default".

String tagPath - Filters on a tag path. Use * as a wildcard for any number of characters and a ? for a single character.

String tagType - The type of tag to create. Possible values are OPC, MEMORY, EXPRESSION, QUERY, Folder, and UDT_INST.

String dataType - The data type of the tag. Not used for UDT instances or folders. Possible values are Int1, Int2, Int4, Int8, Float4, Float8, Boolean, String, and DateTime.

String udtParentType - The name of the parent UDT.

boolean recursive - Recursively search for tags inside of folders.

String sort - Sets the sort order, possible values are ASC and DESC. Sorting is done on the full path of the tag.

Returns

BrowseTag[] - An array of BrowseTag. BrowseTag has the following variables: name, path, fullPath, type, dataType, and the following functions: isFolder(), isUDT(), isOPC(), isMemory(), isExpression(), isQuery().

Scope

All

Examples

Example 1: Browse all tags in a specific folder

 

tags = system.tag.browseTags(parentPath="")

for tag in tags:

    print tag.name, tag.path, tag.fullPath, tag.isFolder(), tag.isUDT(), 

 print tag.isOPC(), tag.isMemory(), tag.isExpression(), tag.isQuery(), 

 print tag.isDB(), tag.type, tag.dataType

 

Example 2: Browse tags of a the same data type

 

tags = system.tag.browseTags(parentPath="", dataType="Int2")

 

Example 3: Browse tags of a the same UDT parent type

 

tags = system.tag.browseTags(parentPath="", udtParentType="Motor")

 

Example 4: Browse tags of a the same type

 

tags = system.tag.browseTags(parentPath="", tagType="OPC")

 

Example 5: Browse tags using a tag path filter

 

tags = system.tag.browseTags(parentPath="", tagPath="*Folder1")

 

Example 6: Recursively browse tags

 

tags = system.tag.browseTags(parentPath="", recursive=True)

 

Example 7: Sort tag in DESC order

 

tags = system.tag.browseTags(parentPath="", sort="DESC")