Cicode Programming Reference > Cicode Function Categories > Super Genie Functions > AssInfo

AssInfo

Gets association information about the current Super Genie (that is information about a variable tag that has been substituted into the Super Genie). You can only call this function on a Super Genie after the associations are completed.

Use this function to display association information as part of the Super Genie. For example, if you have a Super Genie that is a loop controller, you could display the name of the loop at the top of the loop controller box. Each time the Super Genie is used with different associations (specifically a different tag name or equipment.item association) the correct loop name will be displayed.

Note: In some cases it may be beneficial to replace AssInfo with either the AssGetProperty or the AssInfoEx function. If the Tag properties are updated, AssInfo does not get the updated values whereas AssGetProperty does. In addition, the function AssInfoEx has been introduced to make it easier to make legacy Cicode compatible with online changes. In a large number of cases AssInfo can be replaced with AssInfoEx using Find and Replace (see Using Find and Replace in a project). Please be aware that if you are replacing an instance of AssInfo with AssInfoEx in a loop, you may want to make AssInfoEx blocking using the iCached argument to verify you are using the correct value for the Tag in your logic.

Syntax

AssInfo(sArg, nType [, iCachedMode])

sArg:

When you associate variable tags (can use equipment.item to reference the variable tag) with Super Genies, the Super Genie substitution strings are replaced by variable tags. The sArg argument allows you to get information about one of those variable tags. What you need to know is which substitution string it replaced when the association was performed.

Enter the argument number or name (substitution string number or name) of the relevant substitution string. For example, if you want information about the variable that replaced substitution string

?INT 3?

set sArg to 3.

Or

?Level?

set sArg to Level

When you associate a partial variable tag name (or partial equipment.item to reference variable tag) a prefix or suffix needs be added to the association to form a valid tag reference. The Argument sArg needs to be parsed as a string when partial tag names are used for the association ie "[a]?1?[b]".

eg where the substitution is a valid equipment reference and ?INT 1?.HourRun is a valid equipment.item reference to a tag.

set sArg to "?INT 1?.HourRun"

nType:

The type of information to get:

0 - Tag reference as defined in sArg. If the referenced tag is not resolved, returns an empty string.

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

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

19 - Full name (cluster.tagname) of the referenced tag even if the tag is not resolved.

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

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.

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

Type 8 - 16 are only supported when iCachedMode equals to 2 or 3.

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.

iCachedMode:

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

Related Functions

Ass, AssChain, AssMetadata, AssMetadataPage, AssMetadataPopup, AssMetadataWin, AssChainPage, AssChainPopUp, AssChainWin, AssChainWinFree, AssGetProperty, AssGetScale, AssInfoEx, AssPage, AssPopUp, AssScaleStr, AssTag, AssTitle, AssVarTags, AssWin, TagGetProperty, TagGetScale, TagScaleStr, TagInfo, TagInfoEx

Example

//Using a string identifier for the substitution parameter

AssInfo("MILK_LEVEL", 1); (to get Engineering Units of the association )

 

sTag = AssInfo(1, 0);    // Get the name of association 1
sEngLow = AssInfo(1, 4); // get the low engineering scale of association 1 sTag = AssInfo("?INT 1?.HourRun", 0) //Get the name where the super genie association is only part of the tag name

See Also

Super Genie Functions

Published June 2018