This article from InSource shows How to Retrieve Tag Information at Runtime
- Author: Benjamin Davis
- Published: 12/30/2021
- Applies to: Citect
Use the TagInfoEx function built into Citect.
- Create a tag.
- In Graphics Builder, enter TaginfoEx("TestTag", 1) as the display value.
- The tag information will show at runtime.
Here is a list of properties you can retreive...
The type of information to get:
0 - The Tag name from the variables table. This is the same as the Name argument. (Returned to be compatible with the AssInfo() function).
1 - Engineering units
2 - Raw zero scale
3 - Raw full scale
4 - Engineering zero scale
5 - Engineering full scale
6 - Width of the format
7 - Number of decimal places of format
8 - The Tag format as a long integer. The format information is stored in the integer as follows:
- Bits 0-7 - format width
- Bits 8-15 - number of decimal places
- Bits 16 - zero-padded
- Bit 17- left-justified
- Bit 18 - display engineering units
- Bit 20 - exponential (scientific) notation
9 - Logical Unit Number - I/O device number (for internal use)
10 - General Type - Protocol's general data type number for this tag. Type numbers are:
- 0 - Digital
- 1 - Byte
- 2 - Integer16
- 3 - UInteger16
- 4 - Long
- 5 - Real
- 6 - String
- 7 - ULong
- 8 - Undefined
11 - Bit Width - Tag's size in bits. For example, an INT is 16 bits
Note: Types 12 to 15 are only supported when iCachedMode equals to 2 or 3.
12 - Unit Type - Protocol's unit type number for this tag
13 - Unit Address - Tag's address after the protocol DBF's template is applied.
14 - Unit Count - Array size. For example, if the tag's address is I1, the unit count is 50.
15 - Record Number - Tag's record number in variable.DBF - 1. That is, the first tag has a record number of 0.
16 - Comment - As defined in the variable tags list.
17 - ClusterName of the tag.
18 - Full name (cluster.tagname) of the tag.
19 - Reserved for internal operation.
20 - Configured Address of the tag. If the tag is not resolved, returns an empty string.
21 - Network Number - I/O device number (as defined by the Number field of the I/O Devices dialog).
22 - Name of the equipment associated with the Tag. If the tag is not resolved, returns an empty string.
If the tag is a local variable, mode 9 error code 348 is retrieved when cache mode is 0,1,2,3. Modes 12, 13, 14 and 15 will return an empty string (error 274 is trapped).
23 - Reserved for internal use.
24 - Reserved for internal use.
25 - Name of the equipment item associated with the Tag. If the tag is not resolved, returns an empty string.
26 - Custom 1 - a user-defined string.
27 - Custom 2 - a user-defined string.
28 - Custom 3 - a user-defined string.
29 - Custom 4 - a user-defined string.
30 - Custom 5 - a user-defined string.
31 - Custom 6 - a user-defined string.
32 - Custom 7 - a user-defined string.
33 - Custom 8 - a user-defined string.