Cicode Programming Reference > Cicode Function Categories > Tag Functions Introduction > 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(sName, iPercent, iEngUnits [, iCached] [, ClusterName] )

sName:

The name of the tag. The name of the tag can be prefixed by the name of the cluster that is "ClusterName.Tag".

iPercent:

The percentage of full scale of the returned value.

iEngUnits:

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

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

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