Tag Scripts

Tag List

The Tag List script should return the following fields, accessed by index:

 

0

Tag ID (Tag Name)

1

Description

2

Units

3

Plot Min

4

Plot Max

> 4 (optional)

Additional parameters, where column name = parameter name and column value = parameter value.

 

The TagList script will return a list of tags available for this template. The first 5 columns are required and must be returned in the listed order.

Text Box: use ctc_data_training;

select tag_name,tag_desc,tag_unit,tag_plotmin,tag_plotmax
from ctc_tag t
join ctc_source s on s.source_id = t.source_id
where upper(source_name) = upper('{Source}');

Up to 9 optional columns on the end of the record can be used to provide values for custom tokens. These values will be known by their column names, and so the column name must correspond to a custom token name. The names of the first five columns returned in the record set are unimportant and are ignored.

These optional columns are usually needed to uniquely identify a tag in the source database where the pre-defined TagID token is not adequate to find the appropriate data.  The order of the rows is the order in which the tags will be listed in the Tag Browser.

Values are supplied to user-defined tokens via tag switches. For example, if the tag list script has a  custom token named “Long” for the long tag name, use that token name as the tag switch to specify the value to supply to the query for the corresponding parameter:

Location.Source.TagName/Long=LongTagName

Note: If the template is being used by manually defined SQL tags (see System Config_SQL Tag) this script should be blank.

 

Tag Info

The Tag Info script should return the following fields, accessed by index:

 

0

Description

1

Units

2

Plot Min

3

Plot Max

4 (optional)

Interpolation Type

5 (optional)

Draw Mode

6 (optional)

Value Data Type

The TagInfo script is used when a Tag is added to a trend and initial values for its attributes are needed.  The Plot Min and Plot Max fields should be numeric. This script requires the predefined token {TagId}

Text Box: use ctc_data_training;

select tag_desc,tag_unit,tag_plotmin,tag_plotmax,[tag_interptype],[tag_drawmode],[tag_datatype] 
from ctc_tag t
join ctc_source s on s.source_id = t.source_id
where tag_name = '{TagID}' and upper(source_name) = upper('{Source}');

Interpolation Type

 

1

State

2

Continuous (default value if script returns null)

3

Manual

Interpolation controls how PARCview estimates values at times between when actual values are found. When interpolation is Continuous, PARCview will conceptually draw a straight line between adjacent points and return the value on the line at the requested timestamp. State interpolation (or step interpolation) assumes that the value remains constant between samples. When the interpolation type is State, PARCview holds the earlier value as constant up until the new timestamp. Manual interpolation is mostly used for intermittent data such as lab results. This interpolation mode is used to normalize process data to lab tests.

 

Draw Mode

 

0

Continuous (default value if script returns null)

1

Square

2

SquareNoEdge

3

State

4

StateNoEdge

5

Exception

This attribute is used by the trend. Usually the Interpolation and Draw Modes will be set consistently. That is, if a tag’s value will be interpolated by connecting contiguous points, then the draw mode should likely be set to be Continuous.

Value Data Type

The Value Data Type refers to how the value is stored and displayed. It can be entered either as a numeric code that follows the variant-type definitions defined by Microsoft (http://msdn.microsoft.com/en-us/library/cc237865.aspx) or specified with a text string. Common values are listed below.

 

Value Data Type

Numeric Code

Text String

Double

5

Double

Integer

2

Integer

Boolean

11

Bool

Boolean

String (text)

8

String

Text

Digital Text Array

10000

DigText

DigitalText

In addition to simple objects, PARCview recognizes a compound value called Digital Text. Digital text tags have both an integer numeric code as well as a corresponding string representation. An example might be a lab quality tag, where a value of 0 = Fail and 1 = Pass. The read data scripts use an optional column to return data for these tags.

If the value data type is omitted, then PARCview will attempt to figure out a tag’s data type by examining the Value field type returned by one of the queries that returns data.

 

Limit

The Limit script should return the following fields, accessed by index:

 

0

Upper Limit

1

Target

2

Lower Limit

The Limit script should return a single row that specifies the Limits and Target for the given limit type and grade. This script uses the predefined tokens {LimitType}, {BasisValue} and {BasisTime}.