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

TagInfoEx

This function replaces TagInfo and is identical in operation. It 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

STRING TagInfoEx(STRING Name, INT Type [, STRING ClusterName] [, INT CachedMode] )

Name:

The name of the tag or the equipment and item name of a variable tag (using equipment.item notation) from which to get information. The name of the tag can be prefixed by the name of the cluster that is "ClusterName.Tag" or "ClusterName.Equipment.Item".

Note: If the tag name exceeds the length limit of 254 characters the hardware alarm "Tag name exceed length limit" will be raised.

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

Type:

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:

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:

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[50], 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.

ClusterName

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

CachedMode:

Optional parameter that specifies from where to retrieve the value for the property.

-1 - The mode is determined by the INI parameter [Client]TagReadCachedMode.

0 - The property value is retrieved direct from the server in blocking mode and an error code is returned if it is not on the server (or the server is unavailable).

1 - The property value is retrieved from the cache and an error code is returned if the cache is not loaded yet.

2 - The property value is retrieved from the local configuration and an error code is returned if it is not available (this is the traditional behavior).

3 - The property value is retrieved from the cache, if the cache is loaded, and from the local configuration, if the cache is not loaded yet.

Default value is -1.

Note: When retrieving bit width (Type 11) or unit count (Type 14) from local configuration (iCachedMode 2), the value is related to the data structure in the device. For example, MODNET, This is a 16 bit device does not have native LONG and REAL numbers. So when you have a LONG variable, then 2 INTEGERS are needed to store it. In the case, Type 11 against the variable will return 16 and Type 14 will return 2. The combination of these two return values will add up to the correct bits.

Return Value

The value of the information as a string. If unsuccessful, 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

Published June 2018