Maptitude GISDK Help |
Caliper Script contains a number of functions you can use to create and manipulate arrays. In addition, the + operator concatenates two arrays.
GISDK Function |
Summary |
Converts an array element to an integer |
|
Converts an array element to a real number |
|
Converts an array element to a string |
|
Excludes elements from an array |
|
Creates an array that contains the elements of the array a that are also in array b |
|
Computes the number of elements in an array |
|
Determines the largest value in an array of numbers |
|
Determines the smallest value in an array of numbers |
|
Finds the position of a sub-array in an array |
|
Computes the average value of the elements of an array |
|
Compares two arrays, element by element |
|
Makes a copy of the array, including nested sub-arrays, to any depth |
|
Removes elements from an array |
|
Returns the specified sub-array, which must itself be an array |
|
Finds a particular option and its setting in an array of name-value pairs |
|
Finds the value of a particular option in an options array |
|
Finds strings in an array that match one or more search specs |
|
Returns the scope of an array of coordinates |
|
Inserts elements into an array |
|
Converts a proper JSON literal object to an options array |
|
Returns the kurtosis of a set of numbers |
|
Loads an array from a file |
|
Computes the mean (average) of the elements of an array |
|
Computes the median of the elements of an array |
|
Returns the value at which a given percentile is reached |
|
Reads a text file into an array of strings |
|
Reads a group of strings from a file |
|
Returns a new array, with the same elements as the input array, but in the reverse order |
|
Saves an array to a file |
|
Displays a Windows dialog box containing the contents of an array, including nested sub-arrays |
|
Returns the skew of the values in an array |
|
Sorts the elements of an array |
|
Computes the standard deviation of an array of numbers |
|
Extracts a number of elements from an array |
|
Computes the sum of an array of numbers |
|
Transposes an array of arrays, where element b[i][j] = a[j][i] |
|
Returns the variance on an array of numbers |
|
Writes the elements of an array to a text file |
|
Writes the elements of an array to a file, separated by a delimiter |
You can determine the length of an array using ArrayLength() or using the special syntax arrayname.length, as in:
n = names.length
ShowMessage ("There are " + String(n) + " names in the list")
Since you can concatenate arrays, you can increase the size of an array. Here an example, using array x from above:
x = { "New York", "Los Angeles", "Miami"}
y = { "Seattle", "Atlanta"}
x = x + y // x[4] equals "Seattle"
If you change the original array, the array that it is concatenated to will also be changed:
y[2] = {"Chicago"} // x[5] is now "Chicago" as well
To make a completely new copy of an array, use CopyArray().
You can build an array of any length at runtime by concatenating the desired number elements to the array. Note that a variable or array element must be placed in an array to do the concatenation:
window_array = GetWindows("All") // returns an array containing three arrays
map_names = null // initialize the variable for the new array
for i = 1 to window_array[2].length do
if window_array[2][i] = "Map" // type in second sub-array, name in first
then map_names = map_names + { window_array[1][i] }
end
Also note that this is very inefficient if the array may be large and you can dimension the array first. This executes slowly:
slow_array = null
for i = 1 to 1000 do
slow_array = slow_array + {i}
end
This executes much faster:
dim fast_array[1000]
for i = 1 to fast_array.length do
fast_array[i] = i
end
For more information, see...
©2025 Caliper Corporation | www.caliper.com |