Vector Methods
GISDK vectors now have several methods which allow transformations and other operations.
Changes
New in Version 2022.
contains (var search_value)
Returns true if the vector contains the search_value, false otherwise. The method does not raise an error, even when the input does not match the vector type.
arr = {10, 20, 30, 40}
v = a2v(arr)
ret_1 = v.contains(20) // ret = 1
ret_2 = v.contains("hi") // ret = null
ret_3 = v.contains(7) // ret = null
count(array options)
Returns the vector's length. The "Ignore Missing" option can be used to count only non-null values
arr = {10, 20, 30, null, 40, null}
v = a2v(arr)
opt = {"ignore Missing": True}
l = v.Count(opt) // l = 4
find(var value)
Returns the search value if found in the vector, or null if value is not found. The method does not raise an error, even when the input does not match the vector type. For example:
arr = {10, 20, 30, 40}
v = a2v(arr)
test_1 = v.find("hi") // test_1 = null
test_2 = v.find(100) // test_2 = null
test_3 = v.find(10) // test_3 = 10
mean()
Returns the mean of a vector of numbers.
arr = {10, 20, 30, 40}
v = a2v(arr)
m = v.Mean() // m = 25
max()
Returns the maxmum value in a vector.
arr = {10, 20, 30, 40, 1 , 1}
v = a2v(arr)
mi = v.MinIndex() // mi = 1
min()
Returns the minimum value in a vector.
arr = {10, 20, 30, 40, 1 , 1}
v = a2v(arr)
mi = v.MinIndex() // mi = 1
minindex()
Returns the index of the first occurrence of the minimum value in a vector.
arr = {10, 20, 30, 40, 1 , 1}
v = a2v(arr)
mi = v.MinIndex() // mi = 1
percentile(array options)
Returns the n-th percentile of a vector of numbers using the Percentile option value as n. if the Percentile option is null the 50th percentile is returned.
arr = {10, 20, 30, 40}
v = a2v(arr)
p= v.Percentile( {Percentile: 20}) // p = 16
sum ()
Computes the sum of a vector of numbers.
arr = {10, 20, 30, 40}
v = a2v(arr)
s = v.sum() // s = 100
Vector methods can be applied to function results but not to parenthesized expressions. For example:
This a valid use of the sum method.
Pop = GetDataVector(, "Population", ).Sum()
|
©2026 Caliper Corporation |