DspInfo
Extracts individual pieces of object information from an AN. Each AN can have multiple expressions associated with it, and each expression can have multiple variables associated with it. You use an index to refer to each individual expressions or variables. Typically, you would query the number of expressions, then the number of variables in a given expression, then the details of a given variable tag.
Note: Before calling this function you need to first use DspInfoNew() to create a handle to the information block from which you want to extract information.
Syntax
DspInfo(hInfo, Type, Index)
hInfo:
The object information block handle, as returned by DspInfoNew(). This handle identifies the table (or block) where all object data is stored.
Type:
The type of data to extract:
0 - Object title (the name of the object type)
1 - Object expression text
2 - Object expression result text
3 - The variable tag name
4 - Not supported.
Note: Getting the raw value using DspInfo is no longer supported. To get the raw value of a tag, use the TagSubscribe function, specifying a value of “Raw” for the sScaleMode parameter. When using TagSubscribe, you can either call SubscriptionGetAttribute to obtain the value whenever required or register a callback cicode function to run when the value changes. See TagSubscribe for more details.
5 - The engineering value associated with the variable
6 - The Cicode context. Calling DspInfo with this Type will return a string describing the context in which the Cicode expression is contained. For example, if it appears on the horizontal movement tab it would return "Move X".
7 - The number of Cicode expressions. Calling DspInfo with this Type will return the number of Cicode expressions associated with this animation point.
8 - The number of tags in the expression. Calling DspInfo with this Type will return the number of tags that appear in the given Cicode expression.
9 - Name of the cluster in which the variable tag resides.
10 - Full name of the variable tag in the form cluster.tagname.
Index:
An index to the variable within the information block. The required index changes according to the Type as follows:
Return Value
The object information (as a string). A blank string is returned if you specify a non-existent expression or variable.
Related Functions
DspInfoNew, DspInfoField, DspInfoDestroy, TagSubscribe, SubscriptionAddCallback, SubscriptionGetAttribute
Example
INT hInfo;
INT iEngineeringValue;
INT iNumberOfExpressions;
INT iNumberOfTags;
INT iExpressionIndex;
INT iTagIndex;
STRING sObjectType;
STRING sExpressionText;
STRING sExpressionResult;
STRING sExpressionContext;
STRING sTagName;
hInfo = DspInfoNew(AN);
IF (hInfo > -1) THEN
sObjectType = DspInfo(hInfo, 0, 0);
iNumberOfExpressions = StrToInt(DspInfo(hInfo, 7, 0));
FOR iExpressionIndex = 0 TO iExpressionIndex < iNumberOfExpressions DO
sExpressionText = DspInfo(hInfo, 1, iExpressionIndex);
sExpressionResult = DspInfo(hInfo, 2, iExpressionIndex);
sExpressionContext = DspInfo(hInfo, 6, iExpressionIndex);
iNumberOfTags = StrToInt(DspInfo(hInfo, 8, iExpressionIndex));
FOR iTagIndex = 0 TO iTagIndex < iNumberOfTags DO
sTagName = DspInfo(hInfo, 3, iTagIndex);
iEngineeringValue = StrToInt(DspInfo(hInfo, 5, iTagIndex));
..
END
..
END
END
See Also