Built-In Computation Functions
Cogynt Authoring has many built-in functions to help develop accurate, sophisticated computations. For more information about adding computation functions to models, see Adding Functions.
This section describes the available functions in detail. The categories and functions within each category are presented in alphabetical order.
The examples for each function use the following notation:
- Square brackets (
[]
) indicate arrays. - Curly braces (
{}
) indicate groups. - Arrows (
==>
) separate inputs and outputs. Inputs are shown on the left side of the arrow. Outputs are shown on the right side of the arrow.
Aggregation Functions
Aggregation functions provide mechanisms for working with sets of values.
Average
The Average
function returns the average of the input variables.
Usage Information
Category | Details |
---|---|
Number of Arguments | 1+ |
Mandatory Argument Names and Datatypes | arg : An integer or float.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | ignore null (Default: True ): If True , null values are removed from the series before the average is computed. If False , the average is computed including nulls, with nulls given a 0 value. |
Output Datatype(s) | Float |
Note
Integers and floats can both be inputs into the same function. All input data must share the same datatype.
Average
takes any of the following:
- One or more sets of supported types.
- One array
- Two or more scalars.
- A mix of two or more scalars and sets.
- A mix of one array and one or more scalars.
Examples
avg(1,2,3) ==> 2.0
avg(1,null,2,ignoreNull=True) ==> 1.5
avg(1,null,2,ignoreNull=False) ==> 1.0
avg([1,2,3]) ==> 2.0
avg([1,null,3],ignoreNull=False) ==> 1.0
avg([1,2,3],2) ==> [1.5,2.0,2.5]
avg([2,3,10],5,7.0) ==> [2.0,3.0,7.0]
avg([1,2,3],{2,3,4}) ==> {[1,2,2],[1,2,3],[1,2,3]}
avg({1,2,3}) ==> 2.0
avg({1,2,3},2) ==> {1.5,2.0,2.5}
avg({1,2,3},{4,1,6}) ==> {2.5,1.5,4.5}
avg({[1,2,3],[3,4,5],[5,6,7]}) ==> {2.0,4.0,6.0}
Count
The Count
function returns the total number of elements in the input array, or the total number of values for a given field in all the events in the input element.
Usage Information
Category | Details |
---|---|
Number of Arguments | 1 |
Mandatory Argument Names and Datatypes | series : An array or set of any datatype.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | ignore null (default: True ): If True , null values are removed from the series. If False , null values are included. |
Output Datatype(s) | Integer |
Examples
count(["a","b","c"]) ==> 3
count(["a","b",null],ignoreNull=False) ==> 3
count(null) ==> null
count({"a","b","c"}) ==> 3
count({"a","b",null},ignoreNull=True) ==> 2
count({["a","b","c"],["1","2","3"]}) ==> 2
count({["a","b","c"],null},ignoreNull=True) ==> 1
count({null,null,null},ignoreNull=True) ==> 0
Count Unique
The Count Unique
function counts the total number of unique elements in an input array, or the total number of unique events of the input element.
Usage Information
Category | Details |
---|---|
Number of Arguments | 1 |
Mandatory Argument Names and Datatypes | series : An array or set of any datatype.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | ignore null (default: True ): If True , null values are removed from the series. If False , null values are included. |
Output Datatype(s) | Integer |
Examples
countUnique(["a","b","c","a","b"]) ==> 3
countUnique(["a","b",null],ignoreNull=False) ==> 3
countUnique(null) ==> null
countUnique({"a","b","c","a","b"}) ==> 3
countUnique({"a","b",null},ignoreNull=True) ==> 2
countUnique({["a","b","c"],["1","2","3"],["1","2","3"]}) ==> 2
countUnique({["a","b","c"],[null,null,null]},ignoreNull=True) ==> 2
countUnique({["a","b","c"],null},ignoreNull=True) ==> 1
countUnique({null,null,null},ignoreNull=True) ==> 0
Join
The Join
function returns a string containing all input elements joined together by the specified delimiter.
Usage Information
Category | Details |
---|---|
Number of Arguments | 1+ |
Mandatory Argument Names and Datatypes | arg : Any datatype.
|
Optional Argument Names and Datatypes | delimiter : The string to use as the delimiter. (By default, it joins the elements with no space between them.) |
Modifiers | ignore null (default: True ): If True , null values are not included in the output string. If False , null values are included as part of the output string. |
Output Datatype(s) | String |
Note
All input data must share the same datatype.
Join
takes any of the following:
- One or more sets of supported types.
- One array.
- Two or more scalar.
- A mix of two or more scalars and sets.
- A mix of one array and one or more scalar.
Examples
join(1,2,3, delimiter="|") ==> "1|2|3"
join(1,2,null,4, ignoreNull=True) ==> "124"
join(1,2,null,4, ignoreNull=False) ==> null
join([1,2,3]) ==> "123"
join({1,2,3}, delimiter=",") ==> "1,2,3"
join(1,{2,3,4}, delimiter=',') ==> {"1,2","1,3","1,4"}
join({1,2,3},{4,5,6}, delimiter="|") ==> {"1|4","2|5","3|6"}
join({[1,2,3],[4,5,6]}, delimiter=",") ==> "[1,2,3],[4,5,6]"
Max
The Max
function returns the maximum value from the input series of variables.
Usage Information
Category | Details |
---|---|
Number of Arguments | 1+ |
Mandatory Argument Names and Datatypes | arg : An integer, float, string, or datetime.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) |
|
Note
Integers and floats can both be inputs into the same function. All input data must share the same datatype.
Max
takes any of the following:
- One or more sets of supported types.
- One array
- Two or more scalars.
- A mix of two or more scalars and sets.
- A mix of one array and one or more scalars.
Examples
max(1,2,3) ==> 3
max("ABC","efg") ==> "ABC"
max(1,null,2) ==> 2
max([1,2,3]) ==> 3
max([1,null,3]) ==> 3
max([1,2,3],2) ==> [2,2,3]
max(([2,3,10],5,7.0) ==> [7.0,7.0,10.0]
max([1,2,3],{2,3,4}) ==> {[2,2,3],[3,3,3],[4,4,4]}
max({1,2,3}) ==> 3
max({1,2,3},2) ==> {2,2,3}
max({1,2,3},{4,1,6}) ==> {4,2,6}
max({[1,2,3],[3,4,5],[5,6,7]}) ==> {3,5,7}
Min
The Min
function returns the minimum value from the input series of variables.
Usage Information
Category | Details |
---|---|
Number of Arguments | 1+ |
Mandatory Argument Names and Datatypes | arg : An integer, float, string, or datetime.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) |
|
Note
Integers and floats can both be inputs into the same function. All input data must share the same datatype.
Min
takes any of the following:
- One or more sets of supported types.
- One array
- Two or more scalars.
- A mix of two or more scalars and sets.
- A mix of one array and one or more scalars.
Examples
min(1,2,3) ==> 1
min("ABC","efg") ==> "efg"
min(1,null,2) ==> 1
min([1,2,3]) ==> 1
min([1,null,3]) ==> 1
min([1,2,3],2) ==> [1,2,2]
min(([2,3,10],5,7.0)) ==> [2.0,3.0,7.0]
min([1,2,3],|2,3,4|) ==> {[1,2,2],[1,2,3],[1,2,3]}
min({1,2,3}) ==> 1
min({1,2,3},2) ==> {1,2,2}
min({1,2,3},{4,1,6}) ==> {1,1,3}
min({[1,2,3],[3,4,5],[5,6,7]}) ==> {1,3,3}
Nth
The Nth
function returns the value of the nth
element in the input series
.
Usage Information
Category | Details |
---|---|
Number of Arguments | 2 |
Mandatory Argument Names and Datatypes |
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | The function outputs a scalar value of any datatype (the same datatype as the input array subtype/set). |
Examples
nth([1,2,3,4,5],2) ==> 3
nth({1,2,3,4,5},2) ==> 3
nth({1,4,6,34},30) ==> null
Product
The Product
function returns the product of the entered series of numerical values.
Usage Information
Category | Details |
---|---|
Number of Arguments | 1+ |
Mandatory Argument Names and Datatypes | arg : An array or set of integers, floats, and scalar values of integers/floats.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) |
|
Note
Integers and floats can both be inputs for the same function. The output datatype will always be a floating point number if both integers and floats are received as input.
Product
can take any of the following:
- One or more sets of integers/floats.
- One array.
- Two or more scalars.
- A mix of two or more scalars and sets.
- A mix of one array and one or more scalars.
Nulls are ignored, and default to a value of
1
.
Examples
product(2,3,4) ==> 24
product(null,null,null) ==> null
product([2,3,4]) ==> 24
product([2,null,4]) => 8
product([2,3,4],2) ==> [4,6,8]
product([2,3,4],5,7.0) ==> [70.0,105.0,140.0]
product([1,2,3],{2,3,4}) ==> {[2,4,6],[3,6,9],[4,8,12]}
product({2,3,4}) ==> 24
product({1,2,3},2) ==> {2,4,6}
product({2,3,4},{5,7,8},9) ==> {90,189,288}
product({[1,2,3],[3,4,5],[5,6,7]}) ==> {6,60,210}
Std-dev
The Std-dev
function returns the standard deviation of the input series of variables.
Usage Information
Category | Details |
---|---|
Number of Arguments | 1+ |
Mandatory Argument Names and Datatypes | arg : An integer or float.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | ignore null (Default: True ): If True , null values are removed from the series before the standard deviation is computed. If False , the standard deviation is computed with nulls given a value of 0 . |
Output Datatype(s) | Float |
Note
Integers and floats can both be inputs for the same function. All input data must share the same datatype.
Std-dev
can take any of the following:
- One or more sets of integers/floats.
- One array.
- Two or more scalars.
- A mix of two or more scalars and sets.
- A mix of one array and one or more scalars.
Examples
stddev(1,2,3) ==> 0.81649658092773
stddev(1,null,2,ignoreNull=True) ==> 0.5
stddev(1,null,2,ignoreNull=False) ==> 0.81649658
stddev([1,2,3]) ==> 0.81649658092773
stddev([1,null,3],ignoreNull=False) ==> 1.0
stddev([1,2,3],2) ==> [0.5,0.0,0.5]
stddev(([2,3,10],5,7.0) ==> [2.0548047,1.6329932,2.0548047]
stddev([1,2,3],{2,3,4}) ==> {[0.5,0.0,0.5],[1.0,0.5,0.0],[1.5,1.0,0.5]}
stddev({1,2,3}) ==> 0.81649658092773
stddev({1,2,3},2) ==> {0.5,0.0,0.5}
stddev({1,2,3},{4,1,6}) ==> {1.5,0.5,1.5}
stddev({[1,2,3],[3,4,5],[5,6,7]}) ==> {0.81649658,0.81649658,0.81649658}
Sum
The Sum
function returns the sum of the entered series of numerical values.
Usage Information
Category | Details |
---|---|
Number of Arguments | 1+ |
Mandatory Argument Names and Datatypes | arg : An array or set of integers, floats, and scalar values of integers/floats.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) |
|
Note
Integers and floats can both be inputs for the same function. The output datatype will always be a floating point number if both integers and floats are received as input.
sum
can take any of the following:
- One or more sets of integers/floats.
- One array.
- Two or more scalars.
- A mix of two or more scalars and sets.
- A mix of one array and one or more scalars.
Nulls are ignored, and default to a value of
0
.
Examples
sum(2,3,4) ==> 9
sum(null,null,null) ==> null
sum([2,3,4]) ==> 9
sum([2,null,4]) => 6
sum([2,3,4],2) ==> [4,5,6]
sum([2,3,4],5,7.0) ==> [14.0,15.0,16.0]
sum([1,2,3],{2,3,4}) ==> {[3,4,5],[4,5,6],[5,6,7]}
sum({2,3,4}) ==> 9
sum({1,2,3},2) ==> {3,4,5}
sum({2,3,4},{5,7,8},9) ==> {16,19,21}
sum({[1,2,3],[3,4,5],[5,6,7]}) ==> {6,12,18}
sum({[2,3],[3,4,5,6],[5,6,7]}) ==> {5,18,18}
Arithmetic Operations
Arithmetic operations provide mechanisms for performing basic calculations.
Add
The Add
function returns the sum of two or more input variables.
Usage Information
Category | Details |
---|---|
Number of Arguments | 2+ |
Mandatory Argument Names and Datatypes | arg : An integer or float.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | ignore null (Default: True ): If True , null values are not included in the calculation. If False , nulls are included in the calculation and assigned a 0 value. |
Output Datatype(s) |
|
Examples
plus(2,3,4) ==> 9
plus(2,3.5) ==> 5.5
plus(2,null,ignoreNull=False) ==> null
plus(2,null,ignoreNull=True) ==> 2
plus([1,2,3], 2) ==> [3,4,5]
plus({2,3,4},2) ==> {4,5,6}
plus({2,3,4},2,4) ==> {8,9,10}
plus({2,3,4},{5,6,7}) ==> {7,9,11} // parameters must be from same element
Divide
The Divide
function returns the quotient of the two input variables.
Usage Information
Category | Details |
---|---|
Number of Arguments | 2 |
Mandatory Argument Names and Datatypes |
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | Float |
Examples
div(6,2) ==> 3.0
div(6,0) ==> null
div(6,null) ==> null
div([6,4,2],2) ==> [3,2,1]
div({6,4,2},2) ==> {3,2,1}
Modulus
The Modulus
function returns the remainder from dividing the first argument by the second argument.
Usage Information
Category | Details |
---|---|
Number of Arguments | 2 |
Mandatory Argument Names and Datatypes |
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) |
|
Examples
mod(5,2) ==> 2
mod(35.6,2.5) ==> 0.6
mod([2,3,4],2) ==> [0,1,0]
mod({2,3,4},2) ==> {0,1,0}
mod({2,3,4},{1,2,3}) ==> {0,1,3}
Multiply
The Multiply
function returns the product of two or more input variables.
Usage Information
Category | Details |
---|---|
Number of Arguments | 2+ |
Mandatory Argument Names and Datatypes | arg : An integer or float.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | ignore null (Default: True ): If True , null values are not included in the calculation. If False , nulls are included in the calculation and assigned a value of 1 . |
Output Datatype(s) |
|
Examples
mult(2,6) ==> 12
mult(2,3,0.5) ==> 3.0
mult(2,null,ignoreNull=False) ==> null
mult(2,null,ignoreNull=True) ==> 2
mult([1,2,3],2) ==> [2,4,6]
mult({2,3,4},2) ==> {4,6,8}
mult({2,3,4},{2,4,6}) ==> {4,12,24} // parameters must be from same element
Subtract
The Subtract
function returns the difference between the two input variables.
Usage Information
Category | Details |
---|---|
Number of Arguments | 2 |
Mandatory Argument Names and Datatypes | arg : An integer or float.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) |
|
Examples
subtract(3,5) ==> -2
subtract(4,2.5) => 1.5
subtract(4,null) ==> null
subtract({6,4,1},2) ==> {4,2,-1}
subtract({5,4,3},{2,3,4}) ==> {3,1,-1}
Array Functions
Array functions provide mechanisms for processing and evaluating the contents of arrays.
Combine
The Combine
function combines (and optionally deduplicates) the submitted arguments into a single array. They are concatenated in the order that they are supplied to the function.
Usage Information
Category | Details |
---|---|
Number of Arguments | 2+ |
Mandatory Argument Names and Datatypes | var : An array or set of any datatype.
|
Optional Argument Names and Datatypes | N/A |
Modifiers |
|
Output Datatype(s) | An array matching the datatype of the input. |
Note
All input must share the same datatype, except for integers and floats. Integers and floats can both be inputs in the same function. If both integers and floats are received as inputs, the output is an array of floats.
Arrays and scalar values may be inputs in the same function. Sets and scalar values may also be inputs in the same function.
Examples
combine(1,2,3) ==> [1,2,3]
combine(1,2.4,3) ==> [1.0,2.4,3.0] // Mixture of int and float input results in a float array
combine([1,2,3],[4,5,6],[7,8,9,10]) ==> [1,2,3,4,5,6,7,8,9,10]
combine([1,2,3],10,[4,5,6]) ==> [1,2,3,10,4,5,6]
combine({1,2,3},{4,5,6},{7,8,9}) ==> {[1,4,7],[2,5,8],[3,6,9]}
combine({[A],[B],[C]},{[D],[E],[F]}) ==> {[A,D],[B,E],[C,F]}
combine({1,2,3},10,{4,5,6}) ==> {[1,10,4],[2,10,5],[3,10,6]}
Sort
The Sort
function sorts an array, rearranging its elements in either ascending or descending order as specified.
Usage Information
Category | Details |
---|---|
Number of Arguments | 1 |
Mandatory Argument Names and Datatypes | arg : An array or set of datetimes, integers, floats, or strings.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | order (Default: asc ): Specifies whether to sort in ascending (asc ) or descending (desc ) order. |
Output Datatype(s) | An array matching the input datatype. |
Examples
sort([1,4,5,3,2]) ==> [1,2,3,4,5]
sort({["C","A"],["D","E"]}) ==> {["A","C"],["D","E"]}
Unique
The Unique
function returns an array containing the unique values of the input array.
Usage Information
Category | Details |
---|---|
Number of Arguments | 1 |
Mandatory Argument Names and Datatypes | arg : An array of any datatype, or a Group of Arrays of any datatype.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | ignore null (Default: True ): If True , null values are not included in the output (even if there is only one null value). If False , any unique null values are included in the output. |
Output Datatype(s) | An array matching the input datatype. |
Examples
unique([1,2,2,3,3,4]) ==> [1,2,3,4]
unique({["1","2","2","3","3","4"],["A","B","B","b","C"]}) ==> {["1","2","3","4"],["A","B","b","C"]}
Value At
The Value At
function returns the value at the specified index position of the input array. It uses a 0-based index.
Usage Information
Category | Details |
---|---|
Number of Arguments | 2 |
Mandatory Argument Names and Datatypes | arg : An array of any datatype, or a Group of Arrays of any datatype.
index : An integer or set of integers specifying the index position.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | Same as input datatype. |
Note
If the input array does not have an index at the submitted index position, the function returns
null
.
Examples
valueAt([2,7,4,6,1,2],2) ==> 4
valueAt([2,7,4,6,1,2],10) ==> null
valueAt([2,7,4,6,1,2],{0,1,2}) ==> {2,7,4}
valueAt([2,7,4,6,1,2],[0,1,2]) ==> [2,7,4]
valueAt({[2,7,4,6,1,2],[1,2,3],[4,5,6]},2) ==> {4,3,6}
valueAt({[2,7,4,6,1,2],[1,2,3],[4,5,6]},{1,2,3}) ==> {7,3,null}
Comparison Operations
Comparison operations provide mechanisms for evaluating arguments with respect to other arguments.
Note
When arrays are used, the comparison operation applies to the array as a whole, and not to the individual elements of the array.
Normal comparison operators can only take two arrays as arguments. To compare individual array elements, use the array comparison operators.
Contains
The Contains
function checks whether the entered search value
is contained within the input series
. If the series contains the search value, then the function returns True
. Otherwise, it returns False
.
Usage Information
Category | Details |
---|---|
Number of Arguments | 2 |
Mandatory Argument Names and Datatypes |
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | Boolean |
Examples
contains("A",["A","B","C"]) ==> True
contains("a",{"A","B","C"}) ==> False
contains("A",{["1","2","3""],["A","B","C"]}) ==> {False,True}
contains({"A","B","C"},["A","1","2"]) ==> {True,False,False}
contains(["A","B","C"],["A","2","3"]) ==> [True,False,False]
contains(["A","B","C"],{["1","2","3""],["A","B","C"]}) ==> True
contains({"1","D"},{["1","2","3""],["A","B","C"]}) ==> {True,False}
Equals
The Equals
function checks whether the input variables all evaluate the same. It returns True
if the input variables are all equal. Otherwise, it returns False
.
Usage Information
Category | Details |
---|---|
Number of Arguments | 2+ |
Mandatory Argument Names and Datatypes | arg : Any datatype.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | Boolean |
Note
Equals
allows more than one array as arguments. All input arrays must share the same datatype.
Examples
equals(2,3) ==> False
equals("A","A","A") ==> True
equals("A","A","B") ==> False
equals("A","A",null) ==> null
equals([2,3,4],2) ==> [True,False,False]
equals([2,3,4],[2,5,4]) ==> False
equals({5,6,7},{7,6,5}) ==> {False,True,False}
equals({2,3,4},2) ==> {True,False,False}
Greater Than
The Greater Than
function checks whether the first input is greater than the second.
Usage Information
Category | Details |
---|---|
Number of Arguments | 2 |
Mandatory Argument Names and Datatypes | arg : An integer, float, datetime, or string.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | Boolean |
Note
Integers and floats can both be inputs of the same function.
Examples
greaterThan(2,3) ==> False
greaterThan(1,1.5) ==> False
greaterThan("B","A") ==> True
greaterThan([2,3,4],2) ==> [False,True,True]
greaterThan([1,2,3],[1,2,4]) ==> [False,False,False]
greaterThan([1,2,3],[1,2,4,5,6]) ==> [True,True,False,null,null]
greaterThan({2,3,4},2) ==> {False,True,True}
greaterThan({5,6,7},{7,6,5}) ==> {False,False,True}
Greater Than or Equals
The Greater Than or Equals
function checks whether the first input is greater than or equal to the second.
Usage Information
Category | Details |
---|---|
Number of Arguments | 2 |
Mandatory Argument Names and Datatypes | arg : An integer, float, datetime, or string.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | Boolean |
Note
Integers and floats can both be inputs of the same function.
Examples
greaterThanOrEquals(2,3) ==> False
greaterThan(1,1.5) ==> False
greaterThanOrEquals("B","A") ==> True
greaterThanOrEquals([2,3,4],2) ==> [True,True,True]
greaterThanOrEquals([1,2,3],[1,2,4]) ==> [True,True,False]
greaterThanOrEquals([1,2,3],[1,2,4,5,6]) ==> [True,True,False,null,null]
greaterThanOrEquals({2,3,4},2) ==> {False,True,True}
greaterThanOrEquals({5,6,7},{7,6,5}) ==> {False,False,True}
Is Null
The Is Null
function checks whether its input is null. If the input is null, it returns True
. Otherwise, it returns False
.
Usage Information
Category | Details |
---|---|
Number of Arguments | 1 |
Mandatory Argument Names and Datatypes | arg : Any datatype.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | Boolean |
Examples
isNull(null) ==> True
isNull([100,null,2]) ==> False
isNull({100,null,2}) ==> {False,True,False}
isNull({[1,2,3],[null,null,null]}) ==> {False,False}
Less Than
The Less Than
function checks whether the first input is less than the second.
Usage Information
Category | Details |
---|---|
Number of Arguments | 2 |
Mandatory Argument Names and Datatypes | arg : An integer, float, datetime, or string.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | Boolean |
Note
Integers and floats can both be inputs of the same function.
Examples
lessThan(1,1.5) ==> True
lessThan(2,3) ==> True
lessThan("B","A") ==> False
lessThan([2,3,4],2) ==> [False,False,False]
lessThan([1,2,3],[1,2,4]) ==> [False,False,False]
lessThan([1,2,3],[1,2,4,5,6]) ==> [False,False,True,null,null]
lessThan({2,3,4},2) ==> {False,False,False}
lessThan({5,6,7},{7,6,5}) ==> {True,False,False}
Less Than or Equals
The Less Than or Equals
function checks whether the first input is less than or equal to the second.
Usage Information
Category | Details |
---|---|
Number of Arguments | 2 |
Mandatory Argument Names and Datatypes | arg : An integer, float, datetime, or string.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | Boolean |
Note
Integers and floats can both be inputs of the same function.
Examples
lessThanOrEquals(1,1.5) ==> True
lessThanOrEquals(2,3) ==> True
lessThanOrEquals("B","A") ==> False
lessThanOrEquals([2,3,4],2) ==> [True,False,False]
lessThanOrEquals([1,2,3],[1,2,4]) ==> [True,True,False]
lessThanOrEquals([1,2,3],[1,2,4,5,6]) ==> [True,True,True,null,null]
lessThanOrEquals({2,3,4},2) ==> {True,False,False}
lessThanOrEquals({5,6,7},{7,6,5}) ==> {True,True,False}
Not Equal
The Not Equal
functions checks whether the input arguments are identical. If the inputs are not identical, then it returns True
. Otherwise, it returns False
.
Usage Information
Category | Details |
---|---|
Number of Arguments | 2+ |
Mandatory Argument Names and Datatypes | arg : Any datatype.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | Boolean |
Note
All input arguments must be of the same datatype.
Not Equal
allows more than one array as arguments. All input arrays must share the same datatype.
Examples
notEquals(2,3) ==> True
notEquals("A","A","A") ==> False
notEquals("A","A","B") ==> True
notEquals("A","A",null) ==> null
notEquals([2,3,4],2) ==> [True,False,False]
notEquals([2,3,4],[2,5,4]) ==> True
notEquals({5,6,7},{7,6,5}) ==> {True,False,True}
notEquals({2,3,4},2) ==> {False,True,True}
Not Null
The Not Null
function checks whether the input is a non-null value. If the input is not null, the function returns True
. Otherwise, it returns False
.
Usage Information
Category | Details |
---|---|
Number of Arguments | 1 |
Mandatory Argument Names and Datatypes | arg : Any datatype.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | Boolean |
Examples
isNotNull(null) ==> False
isNotNull([100,null,2]) ==> True
isNotNull({100,null,2}) ==> {True,False,True}
isNotNull({[1,2,3],[null,null,null]}) ==> {True,True}
Datatype Conversions
Datatype conversion functions provide mechanisms to convert data of a given type into a different type.
To Array
The To Array
function converts its input to an array. Any set-of-array inputs are automatically flattened.
Usage Information
Category | Details |
---|---|
Number of Arguments | 1+ |
Mandatory Argument Names and Datatypes | arg : Any datatype.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | An array matching the input datatype. |
Examples
toArray("ABC") ==> ["ABC"]
toArray(1,2,3) ==> [1,2,3]
toArray([1,2,3]) ==> [1,2,3]
toArray({1,2,3}) ==> [1,2,3]
toArray({[1,2,3],[4,5,6],[7,8]}) ==> [1,2,3,4,5,6,7,8]
To Boolean
The To Boolean
function converts its input to a Boolean value.
Usage Information
Category | Details |
---|---|
Number of Arguments | 1 |
Mandatory Argument Names and Datatypes | arg : An integer, float, or string. Strings are case-insensitive.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | Boolean |
The supported (case-insensitive) string inputs and their evaluations are as follows:
True | False |
---|---|
True | False |
T | F |
On | Off |
Yes | No |
Y | N |
Examples
toBoolean("T") ==> True
toBoolean("Off") ==> False
toBoolean("Not a boolean string") ==> null
toBoolean(1) ==> True
toBoolean(-1) ==> True
toBoolean(0) ==> False
toBoolean(["Y","F","Hello"]) ==> [True,False,null]
toBoolean({"Y","Off","Yes"}) ==> {True,False,True}
toBoolean({[1,0,1],[0,0,0],[1,1,1]} ==> {[True,False,True],[False,False,False],[True,True,True]})
To Datetime
The To Datetime
function converts the input ISO string or epoch representation of time to the Cogynt-supported Zulu time format (yyyy-MM-ddTHH:mm:ss[.SSS]Z
).
Usage Information
Category | Details |
---|---|
Number of Arguments | 2 |
Mandatory Argument Names and Datatypes |
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | Datetime |
Examples
Dates in the following format do not require a format
string:
toDatetime("2020-10-01T10:00:00Z") ==> "2020-10-01T10:00:00.000Z"
toDatetime("2020-10-01T10:00:00.200Z") ==> "2020-10-01T10:00:00.200Z"
toDatetime("2020-02-01T02:00:00.200-08:00") ==> "2020-02-01T10:00:00.200Z"
toDatetime("2020-02-01T15:30:00.200+05:30") ==> "2020-02-01T10:00:00.200Z"
toDatetime(1663690995000) ==> "2022-09-23T21:35:37.000Z"
Anything else requires a format string:
toDatetime("10/1/2020 10:17:46.384",format="dd/MM/yyyy HH:mm:ss.SSS") ==> "2020-01-10T20:17:46.384Z"
To use timezone offsets, use the X
timezone indicator:
toDatetime("10/1/2020 10:17:46.384-08:00",format="dd/MM/yyyy HH:mm:ss.SSSX") ==> "2020-10-01T18:17:46.384Z"
To use timezone abbreviation, use the Z
timezone indicator:
toDatetime("10/1/2020 10:17:46.384PDT",format="dd/MM/yyyy HH:mm:ss.SSSZ") ==> "2020-10-01T18:17:46.384Z"
Array and group examples:
toDatetime(["10/1/2020 10:17:46.384","10/1/2020 10:17:47.384","10/1/2020 10:17:48.384"], "dd/MM/YYYY HH:mm:ss.SSS") ==> ["2020-01-10T20:17:46.384Z","2020-01-10T20:17:47.384Z","2020-01-10T20:17:48.384Z"]
toDatetime({"10/1/2020 10:17:46.384","10/1/2020 10:17:47.384","10/1/2020 10:17:48.384"}, "dd/MM/YYYY HH:mm:ss.SSS") ==> {"2020-01-10T20:17:46.384Z","2020-01-10T20:17:47.384Z","2020-01-10T20:17:48.384Z"}
To Epoch
The To Epoch
function converts a datetime input to an epoch representation of time.
Usage Information
Category | Details |
---|---|
Number of Arguments | 1 |
Mandatory Argument Names and Datatypes | arg : A datetime to convert.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | Integer |
Examples
toEpoch("2022-09-23T21:35:37.000Z") ==> 1663968937000
toEpoch(["2022-09-23T21:35:37.000Z","2022-09-23T21:35:37.000Z","2022-09-23T21:35:37.000Z"]) ==> [1663968937000,1663968937000,1663968937000]
toEpoch({"2022-09-23T21:35:37.000Z","2022-09-23T21:35:37.000Z","2022-09-23T21:35:37.000Z"}) ==> {1663968937000,1663968937000,1663968937000}
toEpoch({["2022-09-23T21:35:37.000Z","2022-09-23T21:35:37.000Z"],["2022-09-23T21:35:37.000Z","2022-09-23T21:35:37.000Z"],["2022-09-23T21:35:37.000Z","2022-09-23T21:35:37.000Z"]}) ==> {[1663968937000,1663968937000],[1663968937000,1663968937000],[1663968937000,1663968937000]}
To Float
The To Float
function converts integers or strings to floating-point decimal numbers.
Usage Information
Category | Details |
---|---|
Number of Arguments | 1 |
Mandatory Argument Names and Datatypes | arg : An integer or string to convert.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | Float |
Examples
toFloat(1) ==> 1.0
toFloat("200.1") ==> 200.1
toFloat("hello world") ==> null
toFloat([3,2,1]) ==> [3.0,2.0,1.0]
toFloat({3,2,1}) ==> {3.0,2.0,1.0}
toFloat({"3.1","2.1","hello"}) ==> {3.1,2.1,null}
toFloat({[3,2,1],[6,5,4],[9,8,7]}) ==> {[3.0,2.0,1.0],[6.0,5.0,4.0],[9.0,8.0,7.0]}
To Integer
The To Integer
function converts floating point numbers or strings to integers.
Usage Information
Category | Details |
---|---|
Number of Arguments | 1 |
Mandatory Argument Names and Datatypes | arg : A float or string to convert.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | Integer |
Examples
toInt(1.7) ==> 1
toInt("6") ==> 6
toInt([3.14,2.06,7.99]) ==> [3,2,7]
toInt({3.14,2.06,7.99}) ==> {3,2,7}
toInt({[3.0,2.0,1.0],[6.0,5.0,4.0],[9.0,8.0,7.0]}) ==> {[3,2,1],[6,5,4],[9,8,7]}
toInt({"1","2","3.6"}) ==> {1,2,3}
Warning
The following is an invalid use of
To Integer
:toInt("6.24") ==> 6
To IP
The To IP
function converts a string to an IP.
Usage Information
Category | Details |
---|---|
Number of Arguments | 1 |
Mandatory Argument Names and Datatypes | arg : A string to convert.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | IP |
Examples
toIp("127.0.0.1") ==> 127.0.0.1
toIp("127.0.0.1/16") ==> 127.0.0.1/16
toIp("abc") ==> null
toIp(["127.0.0.1","2001:0db8:85a3:0000:0000:8a2e:0370:7334","abc"]) ==> [127.0.0.1, 2001:0db8:85a3::8a2e:0370:7334,null]
toIp({"127.0.0.1/8","2001:0db8:85a3:0000:0000:8a2e:0370:7334/24","abc"}) ==> {127.0.0.1/8, 2001:0db8:85a3::8a2e:0370:7334/24,null}
toIp({["127.0.0.1/8","2001:0db8:85a3:0000:0000:8a2e:0370:7334/24","abc"]}) ==> {[127.0.0.1/8, 2001:0db8:85a3::8a2e:0370:7334/24,null]}
To String
The To String
function converts its input to a string.
Usage Information
Category | Details |
---|---|
Number of Arguments | 1 |
Mandatory Argument Names and Datatypes | arg : The input to convert. It can be any datatype.
|
Optional Argument Names and Datatypes | datetime_format : A string specifying the datetime format to use. |
Modifiers | N/A |
Output Datatype(s) | String |
Examples
toString(10) ==> "10"
toString(3.14) ==> "3.14"
toString(True) ==> "True"
toString(127.0.0.1) ==> "127.0.0.1"
toString("2020-01-10T20:17:46.384Z") ==> "2020-01-10T20:17:46.384Z"
toString("2020-01-10T20:17:46.384Z", datetime_format="dd/MM/yyyy HH:mm:ss.SSS") ==> "10/01/2022 20:17:46.384"
toString("3bfebee5-c780-41c1-82ed-0ec75d54d1f0") ==> "3bfebee5-c780-41c1-82ed-0ec75d54d1f0"
toString("https://www.google.com") ==> "https://www.google.com"
toString(geo-json) ==> "{geo-json}"
toString({1,2,3}) ==> {"1","2","3"}
toString([1,2,3]) ==> "[1,2,3]"
toString({[1,2,3],[1,2,3],[1,2,3]}) ==> {"[]","[]","[]"}
To URL
The To URL
function converts its input to a URL. The protocol for the URL defaults to http://
if not provided.
Usage Information
Category | Details |
---|---|
Number of Arguments | 1 |
Mandatory Argument Names and Datatypes | arg : A string to convert.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | URL |
Examples
toUrl("google.com") ==> "http://google.com"
toUrl(["google.com","amazon.com","twitter.com"]) ==> ["http://google.com","http://amazon.com","http://twitter.com"]
toUrl({"google.com","amazon.com","twitter.com"}) ==> {"http://google.com","http://amazon.com","http://twitter.com"}
toUrl({["google.com","amazon.com","twitter.com"],["facebook.com","instagram.com","tiktok.com"],["cogility.com","tacitred.com","cogynt.com"]}) ==> {["http://google.com","http://amazon.com","http://twitter.com"],["http://facebook.com","http://instagram.com","http://tiktok.com"],["http://cogility.com","http://tacitred.com","http://cogynt.com"]}
Date and Time Functions
Date functions provide mechanisms for processing and transforming dates and times.
Date Add
The Date Add
function adds the given amount of time to the provided date and returns a new date. The timezone is not affected.
Usage Information
Category | Details |
---|---|
Number of Arguments | 2 |
Mandatory Argument Names and Datatypes |
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | Datetime |
Examples
dateAdd(["2022-09-23T21:35:37.000Z","2022-09-23T21:35:38.000Z","2022-09-23T21:35:39.000Z"],increment=5000) ==> ["2022-09-23T21:35:42.000Z","2022-09-23T21:35:43.000Z","2022-09-23T21:35:44.000Z"]
dateAdd(["2022-09-23T21:35:37.000Z","2022-09-23T21:35:38.000Z","2022-09-23T21:35:39.000Z"],increment={5000,4000,3000}) ==> {"2022-09-23T21:35:42.000Z","2022-09-23T21:35:42.000Z","2022-09-23T21:35:42.000Z"}
dateAdd({"2022-09-23T21:35:37.000Z","2022-09-23T21:35:38.000Z","2022-09-23T21:35:39.000Z"},increment={5000,4000,3000}) ==> {"2022-09-23T21:35:42.000Z","2022-09-23T21:35:42.000Z","2022-09-23T21:35:42.000Z"}
dateAdd({["2022-09-23T21:35:37.000Z","2022-09-23T21:35:38.000Z","2022-09-23T21:35:39.000Z"]},increment=5000) ==> {["2022-09-23T21:35:42.000Z","2022-09-23T21:35:43.000Z","2022-09-23T21:35:44.000Z"]}
Date Diff
The Date Diff
function computes the absolute difference between two dates in milliseconds.
Usage Information
Category | Details |
---|---|
Number of Arguments | 2 |
Mandatory Argument Names and Datatypes |
|
Optional Argument Names and Datatypes | N/A |
Modifiers | use timezone (Default: True): TBD |
Output Datatype(s) | Integer |
Examples
dateDiff("2022-09-23T05:35:37.000Z", "2022-09-22T21:35:37.000+0800", useTimezone=True) ==> 0
dateDiff([],"2022-09-23T21:35:37.000Z") ==> []
dateDiff("2022-09-23T21:35:37.000Z",[]) ==> []
dateDiff({},{}) ==> {}
dateDiff({},"2022-09-23T21:35:37.000Z") ==> {}
dateDiff({[],[],[]},"2022-09-23T21:35:37.000Z") ==> {[],[],[]}
dateDiff({[],[],[]},{"2022-09-23T21:35:37.000Z","",""}) ==> {[],[],[]}
Date Part
The Date Part
function returns an integer representing the specified part of the input date.
Usage Information
Category | Details |
---|---|
Number of Arguments | 1 |
Mandatory Argument Names and Datatypes | arg : A datetime.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | date part (Default: y ): The part of the datetime to return. The available options are:
|
Output Datatype(s) | Integer |
Examples
datePart("2022-09-23T21:35:37.000Z", date_part='H') ==> 21
datePart({}, date_part='H') ==> {}
datePart([], date_part='H') ==> []
datePart({[],[],[]},date_part="")
Date Truncate
The Date Truncate
function returns the date after truncating up to and including the given granularity.
Usage Information
Category | Details |
---|---|
Number of Arguments | 1 |
Mandatory Argument Names and Datatypes | arg : A datetime to truncate.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | granularity (Default: second ): The level of specificity for the truncation operation. The available options are:
|
Output Datatype(s) | Datetime |
Examples
dateTruncate("2022-09-23T21:35:37.000Z", granularity='day') ==> "2022-09-23T00:00:00.000Z"
dateTruncate({}, granularity='month') ==> {}
dateTruncate([], granularity='month') ==> []
dateTruncate({[],[],[]}, granularity='month') ==> {}
Now
The Now
function returns the current GMT date and time with millisecond precision.
Usage Information
Category | Details |
---|---|
Number of Arguments | 0 |
Mandatory Argument Names and Datatypes | N/A |
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | Datetime |
Examples
now() ==> "2022-09-23T21:35:37.000Z"
To Local Time
The To Local Time
function converts the input date and time to the local timezone of where the system is running. If no arguments are provided, it returns the date and time from where the system is running.
Usage Information
Category | Details |
---|---|
Number of Arguments | 1 |
Mandatory Argument Names and Datatypes | arg : A datetime to convert.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | Datetime |
Examples
toLocalTime("2022-09-23T21:35:37.000Z")
toLocalTime("2022-09-23T21:35:37.000-0800")
toLocalTime([])
toLocalTime({})
toLocalTime({[],[],[]})
To Time Zone
The To Time Zone
function converts the input date and time to the date and time in the specified timezone.
Usage Information
Category | Details |
---|---|
Number of Arguments | 2 |
Mandatory Argument Names and Datatypes |
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | Datetime |
Examples
toTimeZone("2022-09-23T21:35:37.000Z","-0800") ==> ""
toTimeZone("2022-09-23T21:35:37.000Z","America/Los_Angeles") ==> ""
toTimeZone("2022-09-23T21:35:37.000Z","PDT") ==> ""
toTimeZone([], "") ==> []
toTimeZone({}, "") ==> {}
toTimeZone({["","",""],["","",""],["","",""]},"")
IP Functions
IP functions provide tools for evaluating and processing IPs and their constituent parts.
Note
Any
cidr
argument in an IP function should have a value between1
and32
.
Get Host
The Get Host
function returns the host port of the specified IP as an IP. The network portion is zeroed out. The CIDR value does not change.
Usage Information
Category | Details |
---|---|
Number of Arguments | 1 |
Mandatory Argument Names and Datatypes | IP : An IP from which to retrieve the host port.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | IP |
Examples
getHost("45.184.155.12/8") ==> "0.184.155.12"
getHost("45.184.155.12", cidr=32) ==> "0.0.0.0"
getHost("2001:0db8:85a3:0000:0000:8a2e:0370:7334")
getHost({<ip>,{ip>,...}}) ==> {<host ip>,<host ip>}
getHost([<ip>,{ip>,...}]) ==> [<host ip>,<host ip>]
Get Network
The Get Network
function returns the network portion of the specified IP as an IP. The host port is zeroed out.
If the CIDR argument is valid and non-null, and its value is less than the CIDR in the IP, then the argument CIDR is used. The CIDR used to get the network is the CIDR of the returned IP.
Usage Information
Category | Details |
---|---|
Number of Arguments | 2 |
Mandatory Argument Names and Datatypes | IP : An IP from which to retrieve the network portion.
|
Optional Argument Names and Datatypes | cidr : An integer indicating the CIDR to use. |
Modifiers | N/A |
Output Datatype(s) | IP |
Examples
getNetwork("45.184.155.12") ==> "45.184.155.12"
getNetwork("45.184.155.12", 8) ==> "45.0.0.0"
getNetwork("45.184.155.12", 35) ==>
getNetwork("2001:0db8:85a3:0000:0000:8a2e:0370:7334", 16) ==> "2001::"
getNetwork([]) ==> []
getNetwork([],16) ==> []
getNetwork({})
getNetwork({},{})
getNetwork({[],[],[]},12)
getNetwork({[],[],[]},{})
In Network
The In Network
function checks whether the first IP (ip1
) is in the same network as the second IP (ip2
, the network IP).
Usage Information
Category | Details |
---|---|
Number of Arguments | 2 |
Mandatory Argument Names and Datatypes |
|
Optional Argument Names and Datatypes |
|
Modifiers | N/A |
Output Datatype(s) | Boolean |
Examples
inNetwork("45.184.155.12","") ==> True
inNetwork("45.184.155.12","", cidr1="", cidr2="") ==> True
inNetwork({},{},cidr={})
inNetwork({},{},{},{})
Logical Operations
Logical operations provide mechanisms for evaluating the truth or falsity of Boolean values.
AND
The AND
function returns True
when all its input arguments are True
. Otherwise, it returns False
.
Usage Information
Category | Details |
---|---|
Number of Arguments | 2+ |
Mandatory Argument Names and Datatypes | arg : A Boolean.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | Boolean |
Examples
and(True,True) ==> True
and(True,True,False) ==> False
and(True,null) ==> null
and({False,True,True},{True,False,True}) ==> {False,False,True}
and({False,True,True},True) ==> {False,True,True}
and([True,False,True],False) ==> [False,True,False]
NOT
The NOT
function returns the opposite Boolean value of the input.
Usage Information
Category | Details |
---|---|
Number of Arguments | 1 |
Mandatory Argument Names and Datatypes | arg : A Boolean.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | Boolean |
Examples
not(True) ==> False
not(False) ==> True
not({True,False,True}) ==> {False,True,False}
not([True,False,True]) ==> [False,True,False]
OR
The OR
function returns True
when at least one input argument is True
. Otherwise, it returns False
.
Usage Information
Category | Details |
---|---|
Number of Arguments | 2+ |
Mandatory Argument Names and Datatypes | arg : A Boolean.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | Boolean |
Examples
or(False,False) ==> False
or(True,True,False) ==> True
or(True,null) ==> True
or({False,True,True},{True,False,True}) ==> {True,True,True}
or({False,True,True},False) ==> {False,True,True}
or([True,False,True],False) ==> [True,True,True]
Math Functions
Math functions provide means for performing complex mathematical calculations.
Abs
The Abs
function returns the absolute value of the input.
Usage Information
Category | Details |
---|---|
Number of Arguments | 1 |
Mandatory Argument Names and Datatypes | arg : An integer or float.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | Integer or float. The output datatype matches the input datatype. |
Examples
abs(-9.6) => 9.6
abs(12) => 12
abs(-1E-6) => -1000000
abs([-1,-2,-3]) ==> [1,2,3]
abs({-1,-2,-3}) ==> {1,2,3}
abs({[-1,-2,-3],[-2,3,4],[-3,-4,-5]}) ==> {[1,2,3],[2,3,4],[3,4,5]}
ln
The ln
function returns the natural log of the input.
Usage Information
Category | Details |
---|---|
Number of Arguments | 1 |
Mandatory Argument Names and Datatypes | arg : An integer or float.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | Float |
Examples
ln(-9.6) => null
ln(12) => 2.48490664979
ln(1E-6) => -13.815510558
ln([1,2,3]) ==> [0.0,0.69314718056,1.09861228867]
ln({1,2,3}) ==> {0.0,0.69314718056,1.09861228867}
ln({[1,2,3],[1,2,3],[1,2,3]}) ==> {[0.0,0.69314718056,1.09861228867],[0.0,0.69314718056,1.09861228867],[0.0,0.69314718056,1.09861228867]}
log10
The log10
function returns the common log of the input.
Usage Information
Category | Details |
---|---|
Number of Arguments | TBD |
Mandatory Argument Names and Datatypes | arg : An integer or float.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | Float |
Examples
log10(-9.6) => null?
log10(12) => 1.07918124605
log10(1E-6) => -6.0
log10([10,100,1000]) ==> [1.0,2.0,3.0]
log10({10,100,1000}) ==> {1.0,2.0,3.0}
log10({[10,100,1000,3],[10,100,1000],[10,100,1000]}) ==> {[1.0,2.0,3.0],[1.0,2.0,3.0],[1.0,2.0,3.0]}
Power
The Power
function calculates exponential values by taking an entered value and raising it to the specified power.
Usage Information
Category | Details |
---|---|
Number of Arguments | 2 |
Mandatory Argument Names and Datatypes |
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | Integer |
Examples
pow(9,2) ==> 81
pow(2,|2,3,4|) ==> |4,8,16|
pow([1,2,3],2) ==> [1,4,9]
pow({1,2,3},2) ==> {1,4,8}
pow({1,2,3},{1,2,3}) ==> {1,4,27}
pow({[1,2,3],[1,2,3],[1,2,3]},2) ==> pow([1,4,9],[1,4,9],[1,4,9])
Random Int
The Random Int
function returns a random integer.
Usage Information
Category | Details |
---|---|
Number of Arguments | 0 |
Mandatory Argument Names and Datatypes | N/A |
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | Integer |
Examples
rand() ==> 14
Round
The Round
function rounds an entered float (floating point number) to the specified number of places.
Usage Information
Category | Details |
---|---|
Number of Arguments | 2 |
Mandatory Argument Names and Datatypes |
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | Float |
Examples
round(7.859327) ==> 8.0
round(7.859327,2) ==> 7.86
round({103.383,7.863,6.3477},2) ==> {103.38,7.86,6.35}
round({103.383,7.863,6.3477},{2,3,5}) ==> {103.38,7.863,6.3477}
round([103.383,7.863,6.3477],2) ==> [103.38,7.86,6.35]
round({[103.383,7.863,6.3477],[103.383,7.863,6.3477],[103.383,7.863,6.3477]},2) ==> {[103.38,7.86,6.35],[103.38,7.86,6.35],[103.38,7.86,6.35]}
Sqrt
The Sqrt
function returns the square root of the entered value.
Note
The input must be positive. Otherwise, the
Sqrt
function returns an error.
Usage Information
Category | Details |
---|---|
Number of Arguments | 1 |
Mandatory Argument Names and Datatypes | arg : An integer or float.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | Float |
Examples
sqrt(-9.6) => null?
sqrt(16) => 4.0
sqrt(1E-6) => ??
sqrt([4,9,16]) ==> [2.0,3.0,4.0]
sqrt({4,9,16}) ==> {2.0,3.0,4.0}
sqrt({[4,9,16],[4,9,16],[4,9,16]}) ==> {[2.0,3.0,4.0],[2.0,3.0,4.0],[2.0,3.0,4.0]}
Miscellaneous
Miscellaneous functions do not fit under any of the other categories, but still provide useful mechanisms for creating and processing information.
First Non-Null
The First Non-Null
function returns the first non-null value received, evaluated in the order that arguments are supplied.
Usage Information
Category | Details |
---|---|
Number of Arguments | 2+ |
Mandatory Argument Names and Datatypes | arg : Any datatype. All input arguments must share the same datatype.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | The output datatype matches the input datatype. |
Examples
firstNonNull(null,null,"input3",null,"input5") ==> "input3"
firstNonNull([null,null,3],null,[1,2,3]) ==> [null,null,3]
firstNonNull({1,null,null},{10,20,null},8)
firstNonNull({1,null,null},{10,20,null},8) ==> {1,20,8}
Get System Confidence
The Get System Confidence
function returns the system-computed confidence for the given solution. (This is the same value as the resulting COG_confidence
output field.) If risk computation is not enabled for the template, the functions returns a null value.
Usage Information
Category | Details |
---|---|
Number of Arguments | 0 |
Mandatory Argument Names and Datatypes | N/A |
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | Float |
Examples
getSystemConfidence() ==> 0.65
getSystemConfidence() ==> null // when no risk table is configured
Get URL Part
The Get URL Part
function returns the part of the specified URL that corresponds to the provided part string.
Usage Information
Category | Details |
---|---|
Number of Arguments | 2 |
Mandatory Argument Names and Datatypes | url : A URL containing the part to return.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | part : A string indicating the part of the URL to return. The available options are:
|
Output Datatype(s) | String |
Examples
getUrlPart("https://www.google.com",part="scheme") ==> "https"
getUrlPart("https://www.google.com",part="query") ==> null
getUrlPart(["https://www.google.com"],part="scheme") ==> "https"
getUrlPart(["https://www.google.com","https://www.amazon.com","https://cogynt.io"],part="scheme") ==> ["https","https","https"]
getUrlPart({"https://www.google.com","https://www.amazon.com","https://cogynt.io"},part="scheme") ==> {"https","https","https"})
getUrlPart({[],[],[]},part="scheme") ==> {[],[],[]}
Lexicon Match
The Lexicon Match
function returns an array of matching lexicon entries (words and phrases in the selected lexicon node) if the input expression matches the lexicon. Otherwise, it returns a null value.
Usage Information
Category | Details |
---|---|
Number of Arguments | 1 |
Mandatory Argument Names and Datatypes | arg : A string.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | lexicon node : The specific lexicon node to search. |
Output Datatype(s) | String array |
Examples
lexicon = {
"node1": ['Abc','Def','Ghi'],
"node2": ['123','456','789']
}
lexMatch("Abc 123 Ghi", lexicon['node1']) ==> ['Abc','Ghi']
lexMatch({"Abc 123 Ghi","123 789 Abc"}, lexicon['node2']) ==> {["123"],["123", "789"]}
Make URL
The Make URL
function generates a URL based on the input parameters.
All arguments are required, but all except the host argument can be null. The scheme
value defaults to http
if not provided. The host
value can be an actual host name or a domain name (for example, cogility.com
). See the Java URI class documentation for more details.
Usage Information
Category | Details |
---|---|
Number of Arguments | 1 |
Mandatory Argument Names and Datatypes | host : A string indicating the host.
|
Optional Argument Names and Datatypes |
|
Modifiers | N/A |
Output Datatype(s) | String array |
Examples
makeUrl() ==> "http://"
Random UUID
The Random UUID
function returns a unique UUID.
Usage Information
Category | Details |
---|---|
Number of Arguments | 0 |
Mandatory Argument Names and Datatypes | N/A |
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | UUID |
Examples
randomUuid() ==> '5ee968d0-6301-4826-9a81-a7062a050215'
When
The When
function evaluates a defined expression based on the truth or falsity of the submitted argument. When the argument is nonzero or True
, when
returns the if true
option. Otherwise, it returns the if false
option.
Usage Information
Category | Details |
---|---|
Number of Arguments | 2 |
Mandatory Argument Names and Datatypes |
|
Optional Argument Names and Datatypes |
|
Modifiers | N/A |
Output Datatype(s) | Shares the same datatype as the input value for if true and/or if false . |
Note
At least one of the two optional arguments must be non-null.
Examples
when(True,if_true="ABC",if_false="123") ==> "ABC"
when(True,if_true="ABC") ==> "ABC"
when(False,if_true="ABC") ==> null
when(True,if_false="123") ==> null
when([True,False,True],1,2) ==> [1,2,1]
when([True,False,True],if_true=["A","B","C"],if_false=["D","E","F"]) ==> ["A","E","C"]
when({True,False,True},{"A","B","C"},{"D","E","F"}) ==> {"A","E","C"}
when({[True,False,True],[False,True],[False,False,True]},if_true=[1,2,3],if_false=["A","B","C"]) ==> TBD
Spatial Functions
Spatial functions help process and evaluate geometrical and geographical data.
Distance
The Distance
function returns the distance between two geo-coordinates using the selected output units (miles or kilometers).
Usage Information
Category | Details |
---|---|
Number of Arguments | 2 |
Mandatory Argument Names and Datatypes |
|
Optional Argument Names and Datatypes | N/A |
Modifiers | output unit (Default: mi ): The unit of measurement for the output. The available options are mi (miles) and km (kilometers). |
Output Datatype(s) | Float |
Examples
distance(coord,coord) ==> 3.4
distance([coord,coord,coord],coord) ==> [3.4,2.2,68.9]
distance(coord,[coord,coord,coord]) ==> [3.4,2.2,68.9]
distance({coord,coord,coord},coord) ==> {3.4,2.2,68.9}
distance({coord,coord,coord},{coord,coord,coord}) ==> {3.4,2.2,68.9}
Geo Contains
The Geo Contains
function returns True
if the specified coordinate (coord
) is within the bounds of the specified polygon (geo-poly
). Otherwise, it returns False
.
Usage Information
Category | Details |
---|---|
Number of Arguments | 2 |
Mandatory Argument Names and Datatypes |
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | Boolean |
Examples
geoContains(geo-poly,coord) ==> False
geoContains([geo-poly,geo-poly,geo-poly],coord) ==> [True,False,False]
geoContains(geo-poly,[coord,coord,coord]) ==> [False,True,False]
geoContains({geo-poly,geo-poly,geo-poly},coord) ==> {True,False,False}
geoContains({poly,poly,poly},{coord,coord,coord}) ==> {True,True,False}
Make Geo Point
The Make Geo Point
function converts the submitted latitude and longitude into a single geo-coordinate point.
Usage Information
Category | Details |
---|---|
Number of Arguments | 2 |
Mandatory Argument Names and Datatypes |
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | Geo-coordinate |
Examples
makeGeoPoint(longitude=54.2,latitude=-32.4) ==> geo-coordinate
makeGeoPoint(longitude={54.2,42.6,-23.1},latitude={-32.4,12.3,-49,3}) ==> geo-coordinate
String Functions
String functions provide mechanisms for creating, transforming, and working with strings.
Left
The Left
function returns the specified number of characters from the left of the entered string.
Usage Information
Category | Details |
---|---|
Number of Arguments | 1 |
Mandatory Argument Names and Datatypes | arg : A string.
|
Optional Argument Names and Datatypes | num char (Default: 1 ): An integer indicating the length of the string. |
Modifiers | N/A |
Output Datatype(s) | String |
Note
The length of the string is determined by the
num char
value.If the value of the
arg
integer exceeds the length of the string, thenLeft
returns the complete string.
Examples
left("ABCDEFG",num_char=3) ==> "ABC"
left(["ABCDEFG","1234567","!@#$%^&"],num_char=3) ==> ["ABC","123","!@#"]
left({"ABCDEFG","1234567","!@#$%^&"},num_char=3) ==> {"ABC","123","!@#"}
left({"ABCDEFG","1234567","!@#$%^&"},num_char={1,2,3}) ==> {"A","12","!@#"}
left({["ABCDEFG","1234567","!@#$%^&"],["ABCDEFG","1234567","!@#$%^&"],["ABCDEFG","1234567","!@#$%^&"]},num_char=3) ==> {["ABC","123","!@#"],["ABC","123","!@#"],["ABC","123","!@#"]}
Length
The Length
function returns the total number of characters in the specified string.
Usage Information
Category | Details |
---|---|
Number of Arguments | 1 |
Mandatory Argument Names and Datatypes | arg : A string.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | Integer |
Examples
length("ABCDEFG") ==> 7
length(["ABCDE","1234567","!@#$%^"]) ==> [5,7,6]
length({"ABCDE","1234567","!@#$%^"}) ==> {5,7,6}
length({["ABCDE","1234567","!@#$%^"],["ABCDE","1234567","!@#$%^"],["ABCDE","1234567","!@#$%^"]}) ==> {[5,7,6],[5,7,6],[5,7,6]}
Lower
The Lower
function returns a string where all the characters from the input string are converted to lowercase.
Usage Information
Category | Details |
---|---|
Number of Arguments | 1 |
Mandatory Argument Names and Datatypes | arg : A string.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | String |
Examples
lower("ABCDEFG") ==> "abcdefg"
lower(["ABC","DEF","GHI"]) ==> ["abc","def","ghi"]
lower({"ABC","DEF","GHI"}) ==> {"abc","def","ghi"}
lower({["ABC","DEF","GHI"],["ABC","DEF","GHI"],["ABC","DEF","GHI"]}) ==> {["abc","def","ghi"],["abc","def","ghi"],["abc","def","ghi"]}
Replace All
The Replace All
function returns a string where all occurrences of a given regular expression (regex) in the input string are replaced with the specified replacement string.
Usage Information
Category | Details |
---|---|
Number of Arguments | 3 |
Mandatory Argument Names and Datatypes |
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | String |
Examples
replaceAll("I love pickles!", replace="pickles", with="Cogynt") ==> "I love Cogynt!"
replaceAll("I love pickles!", replace=" ", with="-") ==> "I-love-pickles!"
replaceAll("I love pickles!", replace="food", with="salads") ==> "I love pickles!"
replaceAll(["I love pickles!","I love dogs!","I love cats!"],replace=" ", with="-") ==> ["I-love-pickles!","I-love-dogs","I-love-cats"]
replaceAll({"I love pickles!","I love dogs!","I love cats!"},replace=" ", with="-") ==> {"I-love-pickles!","I-love-dogs","I-love-cats"}
replaceAll({"I love pickles!","I love dogs!","I love cats!"},replace={" ","!","don't like"}, with={"-","...","like"}) ==> {"I-love-pickles!","I love dogs...","I love cats!"}
Replace First
The Replace First
function returns a string where the first occurrence of a given regular expression (regex) in the input string is replaced with the specified replacement string.
Usage Information
Category | Details |
---|---|
Number of Arguments | 3 |
Mandatory Argument Names and Datatypes |
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | String |
Examples
replaceFirst("I love pickles!", replace="pickles", with="Cogynt") ==> "I love Cogynt!"
replaceFirst("I love pickles!", replace=" ", with="-") ==> "I-love pickles!"
replaceFirst("I love pickles!", replace="food", with="salads") ==> "I love pickles!"
replaceFirst(["I love pickles!","I love dogs!","I love cats!"],replace=" ", with="-") ==> ["I-love pickles!","I-love dogs","I-love cats"]
replaceFirst({"I love pickles!","I love dogs!","I love cats!"},replace=" ", with="-") ==> {"I-love pickles!","I-love dogs","I-love cats"}
replaceFirst({"I love pickles!","I love dogs!","I love cats!"},replace={" ","!","don't like"}, with={"-","...","like"}) ==> {"I-love pickles!","I love dogs...","I love cats!"}
Right
The Right
function returns the specified number of characters from the right of the entered string.
Usage Information
Category | Details |
---|---|
Number of Arguments | 1 |
Mandatory Argument Names and Datatypes | arg : A string.
|
Optional Argument Names and Datatypes | num char (Default: 1 ): An integer indicating the number of characters to return. |
Modifiers | N/A |
Output Datatype(s) | String |
Note
If the value of the
num char
integer exceeds the length of the string, thenRight
returns the complete string.
Examples
right("ABCDEFG", num_char=3) ==> "EFG"
right(["ABCDEFG","1234567","!@#$%^&"],num_char=3) ==> ["EFG","567","%^&"]
right({"ABCDEFG","1234567","!@#$%^&"},num_char=3) ==> {"EFG","567","%^&"}
right({"ABCDEFG","1234567","!@#$%^&"},num_char={1,2,3}) ==> {"G","67","%^&"}
right({["ABCDEFG","1234567","!@#$%^&"],["ABCDEFG","1234567","!@#$%^&"],["ABCDEFG","1234567","!@#$%^&"]},num_char=3) ==> {["EFG","567","%^&"],["EFG","567","%^&"],["EFG","567","%^&"]}
Sub String
The Sub String
function returns a substring from an input string, beginning with the submitted starting index and continuing to the specified length.
Usage Information
Category | Details |
---|---|
Number of Arguments | 2 |
Mandatory Argument Names and Datatypes |
|
Optional Argument Names and Datatypes | length (Default: The end of the string.): An integer specifying the length of the substring to return. If null, the default value is used. |
Modifiers | N/A |
Output Datatype(s) | String |
Examples
substring("ABCDEFG",start_index=2,length=3) ==> "CDE"
substring(["ABCDEFG","1234567","!@#$%^&"],start_index=2,length=3) ==> ["CDE","345","#$%"]
substring({"ABCDEFG","1234567","!@#$%^&"},start_index=2) ==> {"CDEFG","34567","#$%^&"}
substring({"ABCDEFG","1234567","!@#$%^&"},start_index={2,3,4},length={1,2,3}) ==> {"CDEFG","4567","%^&"}
Trim
The Trim
function removes leading and trailing spaces from the submitted string and returns the resulting string.
Usage Information
Category | Details |
---|---|
Number of Arguments | 1 |
Mandatory Argument Names and Datatypes | arg : The string to trim.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | String |
Examples
trim(" X\n Y \nZ \t") ==> "X\n Y \nZ \t"
trim([" X\n Y \nZ \t"," space at beginning","space at the end. "]) ==> ["", "space at beginning", "space at the end."]
trim({" X\n Y \nZ \t"," space at beginning","space at the end. "}) ==> {"", "space at beginning", "space at the end."}
trim({[],[],[]}) ==> {[],[],[]}
Upper
The Upper
function returns a string where all characters from the input string are converted to uppercase.
Usage Information
Category | Details |
---|---|
Number of Arguments | 1 |
Mandatory Argument Names and Datatypes | arg : The string to convert.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) | String |
Examples
upper("abcdefg") ==> "ABCDEFG"
upper(["abc","def","ghi"]) ==> ["ABC","DEF","GHI"]
upper({"abc","def","ghi"}) ==> {"ABC","DEF","GHI"}
upper({["abc","def","ghi"],["abc","def","ghi"],["abc","def","ghi"]}) ==> {["ABC","DEF","GHI"],["ABC","DEF","GHI"],["ABC","DEF","GHI"]}