Skip to main content
Version: 2.15.X

Miscellaneous

Miscellaneous functions do not fit under any of the other categories, but still provide useful mechanisms for creating and processing information.

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.

Combination Converter

The Combination Converter function takes an array argument, compares each array element to the column header value, and assigns True if there is a header that matches.

If the combination of columns with True assigned exists in the combination table configured by the user, the function returns the converted value.

Usage Information

CategoryDetails
Number of Arguments1
Mandatory Argument Names and Datatypesarg: A string array or integer array.
  • Scalar Support: True
  • Array Support: True
  • Group of Scalars Support: False
  • Group of Arrays Support: True
Optional Argument Names and DatatypesN/A
Modifiers
  • ignore null (default: True): If True, null values are skipped. If False, null values are compared.
  • Right-click menu that brings up the conversion table.
Output Datatype(s)The datatype of the Value column of the conversion table.

Examples

Sample Combination Table:
|--------------------------------------------------|
| apple | orange | pecan | salad | Converted Value |
|--------------------------------------------------|
| TRUE | TRUE | FALSE | FALSE | 0.2 |
| TRUE | FALSE | FALSE | FALSE | 0.1 |
| FALSE | TRUE | TRUE | FALSE | 0.6 |
| TRUE | FALSE | FALSE | TRUE | 0.9 |
| TRUE | TRUE | TRUE | TRUE | 0.4 |
|--------------------------------------------------|

combinationConverter(['apple', 'orange']) ==> 0.2
combinationConverter(['apple','orange','pecan']) ==> null

combinationConverter(['apple','orange',null], ignore_null=True) ==> 0.2
combinationConverter(['apple','orange',null], ignore_null=False) ==> null

combinationConverter({['apple', 'orange'],['salad','apple']}) ==> {0.2,0.9}
combinationConverter({['apple', 'orange'],['salad','apple','pecan']}) ==> {0.2,null}

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

CategoryDetails
Number of Arguments2+
Mandatory Argument Names and Datatypesarg: Any datatype. All input arguments must share the same datatype.
  • Scalar Support: True
  • Array Support: True
  • Group of Scalars Support: True
  • Group of Arrays Support: False
Optional Argument Names and DatatypesN/A
ModifiersN/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) ==> {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

CategoryDetails
Number of Arguments0
Mandatory Argument Names and DatatypesN/A
Optional Argument Names and DatatypesN/A
ModifiersN/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

CategoryDetails
Number of Arguments2
Mandatory Argument Names and Datatypesurl: A URL containing the part to return.
  • Scalar Support: True
  • Array Support: True
  • Group of Scalars Support: True
  • Group of Arrays Support: True
Optional Argument Names and DatatypesN/A
Modifierspart: A string indicating the part of the URL to return. The available options are:
  • scheme
  • user
  • host
  • port
  • path
  • query
  • fragment
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

CategoryDetails
Number of Arguments1
Mandatory Argument Names and Datatypesarg: A string.
  • Scalar Support: True
  • Array Support: True
  • Group of Scalars Support: True
  • Group of Arrays Support: True
Optional Argument Names and DatatypesN/A
Modifierslexicon 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

CategoryDetails
Number of Arguments1
Mandatory Argument Names and Datatypeshost: A string indicating the host.
  • Scalar Support: True
  • Array Support: False
  • Group of Scalars Support: True
  • Group of Arrays Support: False
Optional Argument Names and Datatypes
  • scheme (Default: http): A string indicating the scheme to use.
  • userinfo (Default: null): A string indicating the user info to use.
  • port (Default: null): A string indicating the port to use.
  • path (Default: null): A string indicating the path to use.
  • query (Default: null): A string indicating the query to use.
  • fragment (Default: null): A string indicating the fragment to use.
ModifiersN/A
Output Datatype(s)String array

Examples

makeUrl() ==> "http://"

Random UUID

The Random UUID function returns a unique UUID.

Usage Information

CategoryDetails
Number of Arguments0
Mandatory Argument Names and DatatypesN/A
Optional Argument Names and DatatypesN/A
ModifiersN/A
Output Datatype(s)UUID

Examples

randomUuid() ==> '5ee968d0-6301-4826-9a81-a7062a050215'

Value Converter

The Value Converter function takes the argument and converts it into a value based on a user-defined conversion table.

Usage Information

CategoryDetails
Number of Arguments1
Mandatory Argument Names and Datatypesarg: A string, integer, string array, or integer array.
  • Scalar Support: True
  • Array Support: True
  • Group of Scalars Support: True
  • Group of Arrays Support: True
Optional Argument Names and DatatypesN/A
ModifiersRight-click menu that brings up the conversion table.
Output Datatype(s)The datatype of the Value column of the conversion table.

Examples

Sample Conversion Table:
{
'abc': 0.2,
'123': 0.5,
'doremi': 0.1
}

valueConverter('doremi') ==> 0.1
valueConverter('abc 123') ==> null
valueConverter(null) ==> null

valueConverter(['abc', '123']) ==> [0.2, 0.5]
valueConverter([null, '123']) ==> [null, 0.5]

valueConverter({'abc', '123'}) ==> {0.2, 0.5}
valueConverter({null, '123'}) ==> {null, 0.5}

valueConverter({['abc',null],['doremi','123']}) ==> {[0.2,null],[0.1,0.5]}
valueConverter({null,['abc','123']}) ==> {null,[0.2,0.5]}

Weighted Risk

The Weighted Risk function performs the same computation of risk as when using the risk table in the pattern view (i.e., the complement of the product of complements of weights).

Usage Information

CategoryDetails
Number of Arguments1+
Mandatory Argument Names and Datatypesarg: A float or float array.
  • Scalar Support: True
  • Array Support: True
  • Group of Scalars Support: True
  • Group of Arrays Support: False
Optional Argument Names and DatatypesN/A
Modifiersignore null (default: True): If True, the computations set null values to 0, and a valid computation occurs. If False, the resulting value will be null instead.
Output Datatype(s)Float
note

If the first input argument is an array, the number of arguments should only be 1.

The function's output will always have a positive value between 0 and 1.

Examples

weightedRisk(0.2,0.5,0.1) ==> 0.64
weightedRisk(0.2,0.5,null, ignore_null=False) ==> null
weightedRisk(0.2,0.5,null, ignore_null=True) ==> 0.6

weightedRisk([0.2, 0.5, 0.1]) ==> 0.64
weightedRisk([0.2, 0.5, null], ignore_null=False) ==> null
weightedRisk([0.2, 0.5, null], ignore_null=True) ==> 0.6

weightedRisk({0,2,0.5,0.1},{0.5,0.2,0.5},{0.1,0.1,0.2}) ==> {0.64,0.64,0.64}

weightedRisk({[0,2,0.5,0.1],[0,2,0.5,0.1],[0,2,0.5,0.1]}) ==> {0.64,0.64,0.64}

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

CategoryDetails
Number of Arguments2
Mandatory Argument Names and Datatypes
  • boolean: The expression to evaluate.
  • if true or if false: The outputs to return if the input expression is true or false, respectively.
  • Scalar Support: True
  • Array Support: True
  • Group of Scalars Support: True
  • Group of Arrays Support: True
Optional Argument Names and Datatypes
  • if true: The output to return if the input expression is true. It can be any datatype, but it must share the same datatype as the input of if false.
  • if false: The output to return if the input expression is false. It can be any datatype, but it must share the same datatype as the input of if true.
ModifiersN/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