SelectedTag
- Last UpdatedJan 25, 2024
- 1 minute read
The SelectedTag method gets the selected tag as identified by the index.
Syntax
[aaTag=] aaHistClientTagPicker.SelectedTag(integer index);
Parameters
index
The numerical identifier for the tag. The identifier is zero-based.
Return Value
Returns the tag or, if it is out of bounds, returns NULL. (It does not return a NULL string.)
Remarks
This method works in conjunction with the SelectedTagCount property.
Example
The following InTouch HMI software example gets all of the selected tags using a loop:
DIM i AS INTEGER;
DIM count AS INTEGER;
Count = #aaHistClientTagPicker3.SelectedTagCount;
FOR i = 0 TO count - 1
%ReturnTag = #aaHistClientTagPicker3.SelectedTag( i );
NEXT;
In this example, Count is the number of tags and is retrieved using the SelectedTagCount property.
The index passed to the SelectedTag() method ranges from 0 to
Count - 1. For example:
-
If the Count was 0, there are no tags selected.
-
If Count is 1, there is one tag selected, and its index is 0.
-
If Count is 5, there are 5 tags, and the indices range from 0 to 4.
Therefore, you must first check to see that Count is not 0 and then you can index appropriately to get the tag.