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

TagGetScale

Gets the value of a tag at a specified scale from the datasource. The value is returned as a formatted string using the tags format specification and (optionally) the engineering units. Use this function to write generic Cicode that will work with any type of tag. This function replaces TagScaleStr.

Syntax

TagGetScale(STRING Name, INT Percent, INT EngUnits [, INT CachedMode] [, STRING ClusterName] )

Name:

The name of the tag, or the equipment and item name of a variable tag (using equipment.item notation). The tag can be prefixed by the name of the cluster that is "ClusterName.Tag".

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

Percent:

The percentage of full scale of the returned value.

EngUnits:

Flag to determine if the value is returned with engineering units:

0 - Do not return the value with engineering units

1 - Return the value with engineering units

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

ClusterName:

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

Return Value

The scale of the tag (as a string).

Related Functions

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

Example

// Display the zero, 50% and full scale of the tag CV_123_PV
DspText(31,0,TagGetScale("CV_123_PV", 0, 1));
DspText(32,0,TagGetScale("CV_123_PV", 50, 1));
DspText(33,0,TagGetScale("CV_123_PV", 100, 1));

See Also

Tag Functions

Published June 2018