Functions from M - Q
max
Return the highest value from a list or array. The list or array is inclusive at both ends.
max(<number1>, <number2>, ...)
max([<number1>, <number2>, ...])
| Parameter | Required | Type | Description |
|---|---|---|---|
<number1>, <number2>, ... | Yes | number | The set of numbers from which you want the highest value. |
[<number1>, <number2>, ...] | Yes | array of numbers | The array of numbers from which you want the highest value. |
| Return value | Type | Description |
|---|---|---|
<max-value> | number | The highest value in the specified array or set of numbers |
Examples
These examples get the highest value from the set of numbers and the array:
max(1, 2, 3)
max(createArray(1, 2, 3))
And return the result 3.
merge
Merges multiple JSON objects or an array of objects together.
merge(<json1>, <json2>, ...)
| Parameter | Required | Type | Description |
|---|---|---|---|
<json1>, <json2>, ... | Yes | objects or array | The set of JSON objects or array to merge together. |
| Return value | Type | Description |
|---|---|---|
<result> | object | The combined JSON object or combined array objects. |
Examples
Say you have the following JSON objects:
json1 = @"{
'FirstName': 'John',
'LastName': 'Smith',
'Enabled': false,
'Roles': [ 'User' ]
}"
json2 =@"{
'Enabled': true,
'Roles': [ 'User', 'Admin' ]
}"
This example merges the JSON objects:
string(merge(json(json1), json(json2)))
And returns the resulting object {"FirstName":"John","LastName":"Smith","Enabled":true,"Roles":["User","Admin"]}.
Say you want to combine objects and a list of objects together. The following example combines JSON object and an array of objects:
merge({k1:'v1'}, [{k2:'v2'}, {k3: 'v3'}], {k4:'v4'})
And returns the object { "k1": "v1", "k2": "v2", "k3": "v3", "k4": "v4" }.
min
Return the lowest value from a set of numbers or an array.
min(<number1>, <number2>, ...)
min([<number1>, <number2>, ...])
| Parameter | Required | Type | Description |
|---|---|---|---|
<number1>, <number2>, ... | Yes | number | The set of numbers from which you want the lowest value |
| [`<number1>`, `<number2>`, ...] | Yes | array of numbers | The array of numbers from which you want the lowest value |
| Return value | Type | Description |
|---|---|---|
<min-value> | number | The lowest value in the specified array or set of numbers |
Examples
These examples get the lowest value in the set of numbers and the array:
min(1, 2, 3)
min(createArray(1, 2, 3))
And return the result 1.
mod
Return the remainder from dividing two numbers. To get the integer result, see div().
mod(<dividend>, <divisor>)
| Parameter | Required | Type | Description |
|---|---|---|---|
<dividend> | Yes | number | The number to divide by the divisor |
<divisor> | Yes | number | The number that divides the dividend. Can't be 0. |
| Return value | Type | Description |
|---|---|---|
<modulo-result> | number | The remainder from dividing the first number by the second number |
Example
This example divides the first number by the second number:
mod(3, 2)
And returns the result 1.
month
Return the month of the specified timestamp.
month('<timestamp>')
| Parameter | Required | Type | Description |
|---|---|---|---|
<timestamp> | Yes | string | The string that contains the timestamp |
| Return value | Type | Description |
|---|---|---|
<number-of-month> | integer | The number of the month in the specified timestamp |
Example
month('2018-03-15T13:01:00.000Z')
And it returns the result 3.
mul
Return the product from multiplying two numbers.
mul(<multiplicand1>, <multiplicand2>)
| Parameter | Required | Type | Description |
|---|---|---|---|
<multiplicand1> | Yes | integer or float | The number to multiply by multiplicand2 |
<multiplicand2> | Yes | integer or float | The number that multiples multiplicand1 |
| Return Value | Type | Description |
|---|---|---|
<product-result> | integer or float | The product from multiplying the first number by the second number. |
Examples
These examples multiple the first number by the second number:
mul(1, 2)
mul(1.5, 2)
And return the following results respectively:
- 2
- 3
newGuid
Return a new Guid string.
newGuid()
| Return Value | Type | Description |
|---|---|---|
<Guid-string> | string | A new Guid string, length is 36 and looks like xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx |
Example
newGuid()
And it returns a result which follows the format xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx.
not
Check whether an expression is false. Return true if the expression is false, or return false if true.
not(<expression>)
| Parameter | Required | Type | Description |
|---|---|---|---|
<expression> | Yes | Boolean | The expression to check |
| Return Value | Type | Description |
|---|---|---|
| true or false | Boolean | Return true if the expression is false. Return false if the expression is true. |
Example 1
These examples check whether the specified expressions are false:
not(false)
not(true)
And return the following results respectively:
- The expression is false, so the function returns
true. - The expression is true, so the function returns
false.
Example 2
These examples check whether the specified expressions are false:
not(equals(1, 2))
not(equals(1, 1))
And return the following results respectively:
- The expression is false, so the function returns
true. - The expression is true, so the function returns
false.
or
Check whether at least one expression is true. Return true if at least one expression is true, or return false if all are false.
or(<expression1>, <expression2>, ...)
| Parameter | Required | Type | Description |
|---|---|---|---|
<expression1>, <expression2>, ... | Yes | Boolean | The expression to check |
| Return Value | Type | Description |
|---|---|---|
| true or false | Boolean | Return true if at least one expression is true. Return false if all expressions are false. |
Example 1
These examples check whether at least one expression is true:
or(true, false)
or(false, false)
And return the following results respectively:
- At least one expression is true, so the function returns
true. - Both expressions are false, so the function returns
false.
Example 2
These examples check whether at least one expression is true:
or(equals(1, 1), equals(1, 2))
or(equals(1, 2), equals(1, 3))
And return the following results respectively:
- At least one expression is true, so the function returns
true. - Both expressions are false, so the function returns
false.
Updated 6 months ago