The documentation for GET_VAR includes the following syntax description:
GET_VAR(Variable[, Key [, Column [,XPath|XQuery]]])
This syntax description is incorrect. The correct syntax descriptions follow.
Update 2019.01.31: The documentation has been updated and now correctly describes the syntax for GET_VAR.
Syntax descriptions for GET_VAR
The type and scope of the VARA determine the syntax description:
Static or XML VARA with scope Freely selected | All other VARAs
|
---|
GET_VAR(VARA, Key [, Column|XPath|XQuery]) | GET_VAR(VARA [, Key] [, Column|XPath|XQuery]) |
Parameters
VARA
The name of the VARA object. Always required.
Key
The name of the key or row to access. Required for Static and XML VARA objects with scope Freely selected.
- Static or XML VARA with scope Freely selected
If the key is not specified, runtime error U00003712 is generated.
- Static or XML VARA with any other scope
If the key is not specified, the scope determines the key that is read.
- Dynamic VARA (SQL, EXEC, FILELIST, etc.)
If the key is not specified, the first row from the results will be read.
Column | Xpath | XQuery
- Static VARA
The Value column to read
If the column is not specified, the first column (Value 1) will be read. - Dynamic VARA (except FILELIST)
The result column to read- RESULT: the first result column will be read.
- 1 to n (where n is the number of columns returned): The referenced column will be read.
If the column is not specified, the first column is read.
The fourth argument
Contrary to the syntax description in the documentation, the Xpath/XQuery argument should be the third argument, not the fourth. If you try to save a script containing a string as the fourth parameter, the following error results:
U04006586 Error found in object 'UC0.XML_TEST.SCRI(Process)', line '14'.
U01001321 Expecting 'Number(int)/Variable' as function parameter '4'.
This error message suggests that GET_VAR can take a fourth (integer) argument, but this behavior is not publicly documented.
See also: Reference dynamic VARA columns by name.