Value Target References

From HLKitWiki
Jump to: navigation, search

Context: HL KitKit Reference … Target References 

See Also: Value Context Transitions

The "value" script context is actually the same as a "field" context, except that the field is being accessed from within a visual script and is therefore read-only in all behaviors. Hence the need to keep the script contexts distinct. The complete list of target references for the "value" context is presented in the table below.

value (Right, Number) Returns the contents of the field as a numeric value. If the field is text, the contents are automatically converted to a suitable value.

Example: result = this.field[myfield].value

text (Right, String) Returns the contents of the field as a string. If the field is numeric, the contents are automatically converted to a suitable string.

Example: result = this.field[myfield].text

isempty (Right, Number) Returns non-zero if the field contains the empty string and zero if it contains text of any length. If used on a numeric field or with an array or matrix, an error is reported. Testing of array and matrix elements must be done via the "compare" intrinsic.

Example: result = this.field[myfield].isempty

ischosen (Right, Number) Returns non-zero if the field contains a pick or a thing that was selected via a menu. If the field is associated with a menu and no selection has yet been made, zero is returned.

Example: result = this.field[myfield].ischosen

delta (Right, Number) Returns the delta component of a user field. The field must be explicitly configured to support delta processing.

Example: result = this.field[myfield].delta

arrayvalue[row] (Right, Number) Returns the contents of a specific element of the array-based field as a numeric value. The index of the element is given by row, where the index is a zero-based value that must be less than the number of rows in the array. If the field is text, the contents are automatically converted to a suitable value.

Example: result = this.field[myfield].arrayvalue[3]

arraytext[row] (Right, Number) Returns the contents of a specific element of the array-based field as a string. The index of the element is given by row, where the index is a zero-based value that must be less than the number of rows in the array. If the field is numeric, the contents are automatically converted to a suitable string.

Example: result = this.field[myfield].arraytext[3]

matrixvalue[row,col] (Right, Number) Returns the contents of a specific element of the matrix-based field as a numeric value. The index of the element is given by row and col, where the indices are zero-based values that must be less than the number of rows and columns in the matrix, respectively. If the field is text, the contents are automatically converted to a suitable value.

Example: result = this.field[myfield].matrixvalue[3,4]

matrixtext[row,col] (Right, String) Returns the contents of a specific element of the matrix-based field as a string. The index of the element is given by row and col, where the indices are zero-based values that must be less than the number of rows and columns in the matrix, respectively. If the field is numeric, the contents are automatically converted to a suitable string.

Example: result = this.field[myfield].matrixvalue[3,4]

history[spl] (Right, String) Generates and returns a text string that contains the change history for the field. The spl parameter is a string that is inserted between entries in the change history, splicing them together for appropriate output. The history report contents depend on the history behavior assigned to the field, as given below:
  • best – Only the notes text for each history entry is reported
  • stack – The notes text for each entry is reported and the adjustment details are included in parentheses with the notes (e.g. "notes (+2)")