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

TagInfo

Gets information about a variable tag. This function allows you to develop generic Cicode and Super Genies.

Syntax

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

Name:

The name of the tag or the equipment and item reference of a variable tag (using equipment.item notation) from which to get information. 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 sName argument. (Returned to be compatible with the AssInfo() function). An empty string is returned if Type is 0.

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 - 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. If the tag is not resolved, returns an empty string.

18 - Full name (cluster.tagname) of the tag. If the tag is not resolved, returns an empty string.

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 - General Type.

 

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.

Note: When retrieving bit width (Type 11) or unit count (Type 14) from the local configuration (iCachedMode 2), the value is related to the data structure in the device. For example, MODNET, is a 16 bit device and does not have native LONG and REAL numbers. So if you have a LONG variable, 2 INTEGERS are needed to store it. In this 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.

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

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.

Related Functions

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

Example

/* Get the engineering full scale value for the variable "PV131" */
EngFullScale = TagInfo("PV131", 5);
/* Get the engineering zero scale value for the array variable "PLC_Array" */
EngZeroScale = TagInfo("PLC_Array", 4);

See Also

Tag Functions

Published June 2018