Cicode Programming Reference > Cicode Function Categories > Tag Functions Introduction > TagInfoEx

TagInfoEx

This function replaces TagInfo and supports online changes. It is recommended therefore that instances of TagInfo in legacy code are migrated to either TagInfoEx or TagGetProperty. New Cicode should use TagGetProperty.

Gets information about a variable tag. This function allows you to develop generic Cicode and Super Genies. Execution can be blocking or non-blocking depending on the iCached argument.

Note: When replacing an instance of TagInfo with TagInfoEx in a loop, you may want to make TagInfoEx blocking using the iCached argument so that you are using the correct value for the Tag in your logic. You should also be aware that TagInfo has different return values if you are using mode 10 for nType.

Syntax

TagInfoEx(sName, nType [, ClusterName] [, iCached] )

sName:

The name of the tag from which to get information. The name of the tag can be prefixed by the name of the cluster that is "ClusterName.Tag".

To get information on a particular element in an array, enter the array name here, followed by the number of the element as follows:

"PLC_Array[9]"

The above example tells the function to get information on the tenth element in PLC_Array (remember, the address of the first element in an array is 0 (zero)).

nType:

The type of information to get:

0 - The Tag name from the variables table. This is the same as sName 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:

9 - Logical Unit Number - I/O device number (for internal use)

10 - Raw Type - Protocol's raw data type number for this tag. Type numbers are:

11 - Bit Width - Tag's size in bits. For example, an INT is 16 bits

12-15 - Not supported

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).

If the tag is a local variable, modes 9, 11 and 17 will return an empty string, while mode 18 will return only the tag name (without the cluster specified).

ClusterName

Specifies the name of the cluster in which the Tag resides. The argument is enclosed in quotation marks.

iCached:

Optional flag to attempt to retrieve the cached value for the property rather than the current value. This makes the function non-blocking. If the property has not yet been cached, an error is set.

0 - Do not force cached read. Cicode is blocking

1 - Force cached read. Cicode is non-blocking

Default value is 1 (true).

Return Value

The value of the information as a string. In case of error an empty string is returned. The error code can be obtained by calling the IsError Cicode function.

Related Functions

AssGetProperty, AssGetScale, AssInfo, AssScaleStr, TagGetProperty, TagGetScale, TagInfo, TagScaleStr

Example

/* Get the engineering full scale value for the variable "PV131". 
Obtain the value from Cluster1 in blocking mode */
EngFullScale = TagInfoEx("PV131", 5, "Cluster1", 0);
/* Get the engineering zero scale value for the array variable "PLC_Array" in non-blocking mode*/
EngZeroScale = TagInfoEx("PLC_Array", 4);

See Also

Tag Functions