CasewareDocs
New in Caseware Cloud Engagements 2026-05See what's new

ExistingTags

Returns the list of existing tags.

Compatibility

Available as of IDEA version 9.0

Syntax

ExistingTags

Remarks

An error is raised if PerformTask has not been called.

tag.TagName property represents the ID of the tag, not the name.

Available properties for tag members of the list
Properties Description
TagName tag ID
FieldName Name of the associated field to the tag
Type Type of FieldName (0 for "Not defined", 1 for Boolean, 2 for Character, 4 for Numeric, 8 for Date, 16 for Time, 32 for Multistate)

IsNumeric, IsDate, IsTime, IsChar are related to FieldName.

Example

Dim CheckTagAs Object 
Dim db As Object
Dim tag As Object
Dim existingTagsAs Variant
Dim fileName As String

Sub Main
'Get the name of the database.
fileName = SmartContext.PrimaryInputFile

Set db = Client.OpenDatabase(fileName)
Set CheckTag = SmartContext.MacroCommands.TagManagement.CheckTagExistence

'Attaches an IDEA database to check tag existence context.
Set CheckTag.Database = db

'Populate the existing and missing tags collection.
CheckTag.Add "Tag1" 'Add tag with ID "Tag1"
CheckTag.Add "Tag2" 'Add tag with ID "Tag2"
CheckTag.PerformTask

'Getting tagged field name.
Set existingTags = CheckTag.ExistingTags
For each tag in ExistingTags

'Writing in log file.
SmartContext.Log.LogMessage("tag.FieldName: " & tag.FieldName)
Next

'Close the database.
db.Close
Set db = Nothing

'Release objects.
Set CheckTag = Nothing
Set tag = Nothing

End Sub
ExistingTags | Caseware Docs