Used to access data sets, functions and variables by using their names.
Syntax
$Expression$
or
$Expression$ As Object
The syntax of the indirection operator consists of the following elements:
Element |
Description |
---|---|
Expression |
Any expression which returns a string. |
Remarks
The operator allows indirect access to any objects, e.g. a data set or a document, by using its path name.
You can use the above syntax at all positions in the code where an object reference is permitted.
A direct object reference, such as \Data\Signal1 is resolved when the FPScript formula is compiled. An indirect object reference, e.g. $"\Data\Signal1"$, is only resolved when the FPScript code is executed. Formulas that use the indirection operator are recalculated every time they are updated. If you access a different formula using the indirection operator, this formula will be updated before each access to the data.
The indirection operator otherwise behaves like a direct object reference. If you refer to a data object, it returns its data and if you refer to another object, it returns a reference to this object.
To obtain an object reference to a data object, you must append the As Object addition or use the Set statement.
Available In
FlexPro View, Basic, Professional, Developer Suite
Examples
$"DataSet"$ |
Returns the content of a data set called "DataSet". |
$"DataSet"$ As Object |
Returns an object reference to the data set. |
$"Folder.fld"$ |
Does not return an object reference to the folder but a list of the data sets in the folder. (A folder is also a data object) |
$"Folder.fld"$ As Object |
Returns an object reference to the folder. |
$"Diagram.2d"$ |
Provides an object reference to the 2D diagram. |
Set Obj = $“DataSet"$ or Dim Obj = $"DataSet"$ As Object |
Assigns an object reference to the data set to the variable. |
$"\\ActivatedFolder\\DataSet"$ |
Returns the content of a data set with the name "DataSet", which is located in the activated subfolder of the root folder. |
$"Signal.Y"$ or $"Signal"$.Y |
Returns the content of the Y component of a data set called "Signal". |
$"Function"$(Signal) |
Calls the FPScript function "Function" and passes Signal as the argument. |
DataSet.$"Comments"$ |
Reads the object property called "Comments" from the data set. |
$"\\Folder1\\MyDoc.doc"$.Name |
Returns the name of a document "MyDoc" located in the folder "Folder1". |
Dim names, max, globalmax |
Calculates the global maximum of all data sets located in the root folder and whose names begin with "Data". |
names = .Parent.Objects("Data.*").Names
For Each Row i In names Do max = Maximum($names[i]$) If DataType(globalmax) == TYPE_EMPTY Or max > globalmax then globalmax = max End End |
See Also
* This operator is not available in FlexPro View.