Get
Returns the properties of arrays and/or objects output by either a Script function, or another Get function. For more information, see Script.
Get Overview
The Get function is used to access properties of objects returned by a Script function. It requires a minimum of two arguments: a reference to a Script function, or another Get function that returns an Object or Array; and either a string that denotes the property of an Object, or a dot-separated path to a property of a sub-Object. Optionally, a third argument can be specified to access a zero-based array index, when an array is referenced.
The returned value of the Get function is the value of the property (or indexed array element), and can be any of the following types:
- A number
- true (1) or false (0)
- A string
- A Binary data structure
- A Blobs, Edges, Hist, IDMax, or Patterns data structure
- A shape object. For more information, see Shape Objects.
- An Object or Array data structure
Get Example
For this example, a Script function in cell B3 has a run method that returns an object:
Tool.prototype.run = function(n) { this.updateStats(n); return { total: this._total; stats: { avg: this._avg, range: { max: this._max, min: this._min }, values: this._valueArray } }; };
The following Get functions would return simple numbers (assuming the returned values are numeric):
- Get(B3, "total")
- Get(B3, "stats.avg")
- Get(B3, "stats.range.max")
- Get(B3, "stats.range.min")
The following Get function would return the "range" sub-object, which could be passed into another Script or Get function:
- Get(B3, "stats.range")
The following Get function would return element 37 from the values array:
- Get(B3, "stats.values", 37)
Get Inputs
Syntax: Get(Script/Get,Object Property and or Array,[Array Index])
Parameter | Description |
---|---|
Specifies a reference to a Script function or another Get function that returns an Object or Array data structure. |
|
Specifies a reference to a property of an Object data structure, either as a string (the name of the property) or a dot-separated path to a property of a sub-object; or an Array data structure. |
|
Specifies an optional argument to an index of an array when an Array data structure is referenced. |
Get Outputs
Returns |
The function will return the value of the property (or indexed array element), and may return any of the following types:
|
For more information, see Scripting Functions.