Difference between revisions of "Value Context"

From HLKitWiki
Jump to: navigation, search
(New page: {{context|Kit Reference|Context Transitions}} See Also: Value Target References The "value" context parallels a "field" context, with the key distinction being that all values are re...)
 
Line 1: Line 1:
{{context|Kit Reference|Context Transitions}}
+
{{contextmulti|Kit Reference}}
  
See Also: [[Value Target References]]
+
Jump to: [[#references|Target References]]
 +
 
 +
The "value" context represents any field within the pick or thing associated with a template. The value context is used for display only, so all aspects of the field are always read-only.
 +
 
 +
==Context Transitions{{anchor|#transitions}}==
  
 
The "value" context parallels a "field" context, with the key distinction being that all values are read-only, since they are intended for display only. From within a "value" context, you can utilize the following set of valid context transitions:
 
The "value" context parallels a "field" context, with the key distinction being that all values are read-only, since they are intended for display only. From within a "value" context, you can utilize the following set of valid context transitions:
Line 8: Line 12:
 
|class="leftnormal"|-None-
 
|class="leftnormal"|-None-
 
|There are no transitions from within a value context.
 
|There are no transitions from within a value context.
 +
|-
 +
|}
 +
 +
==Target References{{anchor|#references}}==
 +
 +
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.
 +
 +
:{| class="infotable"
 +
|class="leftnormal"|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.<br>
 +
Example: result = this.field[myfield].value<br>
 +
|-
 +
|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.<br>
 +
Example: result = this.field[myfield].text<br>
 +
|-
 +
|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.<br>
 +
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.<br>
 +
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.<br>
 +
Example: result = this.field[myfield].delta<br>
 +
|-
 +
|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.<br>
 +
Example: result = this.field[myfield].arrayvalue[3]<br>
 +
|-
 +
|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.<br>
 +
Example: result = this.field[myfield].arraytext[3]<br>
 +
|-
 +
|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.<br>
 +
Example: result = this.field[myfield].matrixvalue[3,4]<br>
 +
|-
 +
|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.<br>
 +
Example: result = this.field[myfield].matrixvalue[3,4]<br>
 +
|-
 +
|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:
 +
<ul class="sets">
 +
<li>best – Only the notes text for each history entry is reported</li>
 +
<li>stack – The notes text for each entry is reported and the adjustment details are included in parentheses with the notes (e.g. "notes (+2)")</li>
 +
</ul>
 
|-
 
|-
 
|}
 
|}

Revision as of 16:42, 7 December 2008

Context: HL KitKit Reference  … Multiple Sources

Jump to: Target References

The "value" context represents any field within the pick or thing associated with a template. The value context is used for display only, so all aspects of the field are always read-only.

Context Transitions

The "value" context parallels a "field" context, with the key distinction being that all values are read-only, since they are intended for display only. From within a "value" context, you can utilize the following set of valid context transitions:

-None- There are no transitions from within a value context.

Target References

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)")