Functions from A - D
abs
Return the absolute value of the specified number.
abs(<number>)
Parameter | Required | Type | Description |
---|---|---|---|
<number> | Yes | number | Number to get absolute value of |
Return value | Type | Description |
---|---|---|
<result> | number | The result from computing the absolute value. |
Examples
These examples compute the absolute value:
abs(3.12134)
abs(-3.12134)
And both return the result 3.12134.
add
Return the result from adding two or more numbers (pure number case) or concatenating two or more strings (other case).
add(<item1>, <item2>, ...)
Parameter | Required | Type | Description |
---|---|---|---|
<item1> , <item2> ,... | Yes | any | items |
Return value | Type | Description |
---|---|---|
<result-sum> | number or string | The result from adding the specified numbers or the concat result. |
Example
This example adds the specified numbers:
add(1, 1.5)
And returns the result 2.5.
This example concatenates the specified items:
add('hello',null)
add('hello','world')
And returns the results
- hello
- helloworld
addDays
Add a number of days to a timestamp in an optional locale format.
addDays('<timestamp>', <days>, '<format>'?, '<locale>'?)
Parameter | Required | Type | Description |
---|---|---|---|
<timestamp> | Yes | string | The string that contains the timestamp which must be standard UTC ISO format YYYY-MM-DDTHH:mm:ss.fffZ . |
<days> | Yes | integer | The positive or negative number of days to add. |
<format> | No | string | A custom format pattern. The default format for the timestamp is UTC ISO format, YYYY-MM-DDTHH:mm:ss.fffZ , which complies with ISO 8601. |
<locale> | No | string | An optional locale of culture information. |
Return value | Type | Description |
---|---|---|
<updated-timestamp> | string | The timestamp plus the specified number of days |
Example 1
This example adds 10 days to the specified timestamp:
addDays('2018-03-15T13:00:00.000Z', 10)
And returns the result 2018-03-25T00:00:00.000Z.
Example 2
This example subtracts five days from the specified timestamp:
addDays('2018-03-15T00:00:00.000Z', -5)
And returns the result 2018-03-10T00:00:00.000Z.
Example 3
This example adds 1 day to the specified timestamp in the de-DE locale:
addDays('2018-03-15T13:00:00.000Z', 1, '', 'de-dE')
And returns the result 16.03.18 13:00:00.
addHours
Add a number of hours to a timestamp in an optional locale format.
addHours('<timestamp>', <hours>, '<format>'?, '<locale>'?)
Parameter | Required | Type | Description |
---|---|---|---|
<timestamp> | Yes | string | The string that contains the timestamp. |
<hours> | Yes | integer | The positive or negative number of hours to add. |
<format> | No | string | A custom format pattern. The default format for the timestamp is UTC ISO format, YYYY-MM-DDTHH:mm:ss.fffZ , which complies with ISO 8601. |
<locale> | No | string | An optional locale of culture information. |
Return value | Type | Description |
---|---|---|
<updated-timestamp> | string | The timestamp plus the specified number of hours |
Example 1
This example adds 10 hours to the specified timestamp:
addHours('2018-03-15T00:00:00.000Z', 10)
And returns the result 2018-03-15T10:00:00.000Z.
Example 2
This example subtracts five hours from the specified timestamp:
addHours('2018-03-15T15:00:00.000Z', -5)
And returns the result 2018-03-15T10:00:00.000Z.
Example 3
This example adds 2 hours to the specified timestamp in the de-DE locale:
addHours('2018-03-15T13:00:00.000Z', 2, '', 'de-DE')
And returns the result 15.03.18 15:00:00.
addMinutes
Add a number of minutes to a timestamp in an optional locale format.
addMinutes('<timestamp>', <minutes>, '<format>'?, '<locale>'?)
Parameter | Required | Type | Description |
---|---|---|---|
<timestamp> | Yes | string | The string that contains the timestamp |
<minutes> | Yes | integer | The positive or negative number of minutes to add |
<format> | No | string | A custom format pattern. Default: UTC ISO format YYYY-MM-DDTHH:mm:ss.fffZ |
<locale> | No | string | An optional locale of culture information |
Return value | Type | Description |
---|---|---|
<updated-timestamp> | string | The timestamp plus the specified number of minutes |
Example 1
This example adds 10 minutes to the specified timestamp:
addMinutes('2018-03-15T00:10:00.000Z', 10)
And returns the result 2018-03-15T00:20:00.000Z.
Example 2
This example subtracts five minutes from the specified timestamp:
addMinutes('2018-03-15T00:20:00.000Z', -5)
And returns the result 2018-03-15T00:15:00.000Z.
Example 3
This example adds 30 minutes to the specified timestamp in the de-DE locale:
addMinutes('2018-03-15T00:00:00.000Z', 30, '', 'de-DE')
And returns the result 15.03.18 13:30:00.
addOrdinal
Return the ordinal number of the input number.
addOrdinal(<number>)
Parameter | Required | Type | Description |
---|---|---|---|
<number> | Yes | integer | The numbers to convert to an ordinal number |
Return value | Type | Description |
---|---|---|
<result> | string | The ordinal number converted from the input number |
Example
addOrdinal(11)
addOrdinal(12)
addOrdinal(13)
addOrdinal(21)
addOrdinal(22)
addOrdinal(23)
And respectively returns these results:
- 11th
- 12th
- 13th
- 21st
- 22nd
- 23rd
addProperty
Add a property and its value, or name-value pair, to a JSON object, and return the updated object. If the object already exists at runtime the function throws an error.
addProperty('<object>', '<property>', value)
Parameter | Required | Type | Description |
---|---|---|---|
<object> | Yes | object | The JSON object where you want to add a property |
<property> | Yes | string | The name of the property to add |
<value> | Yes | any | The value of the property |
Return value | Type | Description |
---|---|---|
<updated-object> | object | The updated JSON object after adding a new property |
Example
This example adds the accountNumber property to the customerProfile object, which is converted to JSON with the json() function. The function assigns a value that is generated by the newGuid() function, and returns the updated object:
addProperty(json('customerProfile'), 'accountNumber', newGuid())
addSeconds
Add a number of seconds to a timestamp.
addSeconds('<timestamp>', <seconds>, '<format>'?)
Parameter | Required | Type | Description |
---|---|---|---|
<timestamp> | Yes | string | The string that contains the timestamp |
<seconds> | Yes | integer | The positive or negative number of seconds to add |
<format> | No | string | A custom format pattern. Default: UTC ISO format YYYY-MM-DDTHH:mm:ss.fffZ |
Return value | Type | Description |
---|---|---|
<updated-timestamp> | string | The timestamp plus the specified number of seconds |
Example 1
This example adds 10 seconds to the specified timestamp:
addSeconds('2018-03-15T00:00:00.000Z', 10)
And returns the result 2018-03-15T00:00:10.000Z.
Example 2
This example subtracts five seconds to the specified timestamp:
addSeconds('2018-03-15T00:00:30.000Z', -5)
And returns the result 2018-03-15T00:00:25.000Z.
addToTime
Add a number of time units to a timestamp in an optional locale format. See also getFutureTime().
addToTime('<timestamp>', '<interval>', <timeUnit>, '<format>'?, '<locale>'?)
Parameter | Required | Type | Description |
---|---|---|---|
<timestamp> | Yes | string | The string that contains the timestamp |
<interval> | Yes | integer | The number of specified time units to add |
<timeUnit> | Yes | string | The unit of time to use with interval. Possible units are "Second", "Minute", "Hour", "Day", "Week", "Month", and "Year". |
<format> | No | string | A custom format pattern. Default: UTC ISO format YYYY-MM-DDTHH:mm:ss.fffZ , which complies with ISO 8601. |
<locale> | No | string | An optional locale of culture information |
Return value | Type | Description |
---|---|---|
<updated-timestamp> | string | The timestamp plus the number of specified time units with the given format. |
Example 1
This example adds one day to specified timestamp.
addToTime('2018-01-01T00:00:00.000Z', 1, 'Day')
And returns the result 2018-01-02T00:00:00.000Z.
Example 2
This example adds two weeks to the specified timestamp.
addToTime('2018-01-01T00:00:00.000Z', 2, 'Week', 'MM-DD-YY')
And returns the result in the 'MM-DD-YY' format as 01-15-18.
all
Determine whether all elements of a sequence satisfy a condition.
all(<sequence>, <item>, <condition>)
Parameter | Required | Type | Description |
---|---|---|---|
<sequence> | Yes | object | A sequence to be evaluated. |
<item> | Yes | string | Refers to the elements to evaluate in the sequence. |
<condition> | Yes | expression | The expression to evaluate the condition. |
Return value | Type | Description |
---|---|---|
true or false | Boolean | Return true if all elements satisfy a condition. Return false if at least one doesn't. |
Examples
These examples determine if all elements of a sequence satisfy a condition:
all(createArray(1, 'cool'), item, isInteger(item))
all(createArray(1, 2), item => isInteger(item))
And return the following results respectively:
- false, because both items in the sequence aren't integers.
- true, because both items in the sequence are integers.
and
Check whether all expressions are true. Return true
if all expressions are true, or return false
if at least one expression is false.
and(<expression1>, <expression2>, ...)
Parameter | Required | Type | Description |
---|---|---|---|
<expression1> , <expression2> , ... | Yes | Boolean | The expressions to check |
Return value | Type | Description |
---|---|---|
true or false | Boolean | Return true if all expressions are true. Return false if at least one expression is false. |
Example 1
These examples check whether the specified Boolean values are all true:
and(true, true)
and(false, true)
and(false, false)
And respectively returns these results:
- Both expressions are true, so the functions returns
true
. - One expression is false, so the functions returns
false
. - Both expressions are false, so the function returns
false
.
Example 2
These examples check whether the specified expressions are all true:
and(equals(1, 1), equals(2, 2))
and(equals(1, 1), equals(1, 2))
and(equals(1, 2), equals(1, 3))
And respectively returns these results:
- Both expressions are true, so the functions returns
true
. - One expression is false, so the functions returns
false
. - Both expressions are false, so the functions returns
false
.
any
Determine whether any elements of a sequence satisfy a condition.
all(<sequence>, <item>, <condition>)
Parameter | Required | Type | Description |
---|---|---|---|
<sequence> | Yes | object | A sequence to be evaluated. |
<item> | Yes | string | Refers to the elements to evaluate in the sequence. |
<condition> | Yes | expression | The expression to evaluate the condition. |
Return value | Type | Description |
---|---|---|
true or false | Boolean | Return true if all elements satisfy the condition. Return false if at least one doesn't. |
Examples
These examples determine if all elements of a sequence satisfy a condition:
any(createArray(1, 'cool'), item, isInteger(item))
any(createArray('first', 'cool'), item => isInteger(item))
And return the following results respectively:
- true, because at least one item in the sequence is an integer
- false, because neither item in the sequence is an integer.
average
Return the number average of a numeric array.
average(<numericArray>)
Parameter | Required | Type | Description |
---|---|---|---|
<numericArray> | Yes | array of number | The input array to calculate the average |
Return value | Type | Description |
---|---|---|
<average-of-array> | number | The average value of the given array |
Example
This example calculates the average of the array in createArray()
:
average(createArray(1,2,3))
And returns the result 2.
base64
Return the base64-encoded version of a string or byte array.
base64('<value>')
Parameter | Required | Type | Description |
---|---|---|---|
<value> | Yes | string or byte array | The input string |
Return value | Type | Description |
---|---|---|
<base64-string> | string | The base64-encoded version of the input string |
Example 1
This example converts the string hello to a base64-encoded string:
base64('hello')
And returns the result "aGVsbG8=".
Example 2
This example takes byteArr
, which equals new byte[] { 3, 5, 1, 12 }
:
base64('byteArr')
And returns the result "AwUBDA==".
base64ToBinary
Return the binary array of a base64-encoded string.
base64ToBinary('<value>')
Parameter | Required | Type | Description |
---|---|---|---|
<value> | Yes | string | The base64-encoded string to convert |
Return value | Type | Description |
---|---|---|
<binary-for-base64-string> | byte array | The binary version of the base64-encoded string |
Example
This example converts the base64-encoded string AwUBDA== to a binary string:
base64ToBinary('AwUBDA==')
And returns the result new byte[] { 3, 5, 1, 12 }.
base64ToString
Return the string version of a base64-encoded string, effectively decoding the base64 string.
base64ToString('<value>')
Parameter | Required | Type | Description |
---|---|---|---|
<value> | Yes | string | The base64-encoded string to decode |
Return value | Type | Description |
---|---|---|
<decoded-base64-string> | string | The string version of a base64-encoded string |
Example
This example converts the base64-encoded string aGVsbG8= to a decoded string:
base64ToString('aGVsbG8=')
And returns the result hello.
binary
Return the binary version of a string.
binary('<value>')
Parameter | Required | Type | Description |
---|---|---|---|
<value> | Yes | string | The string to convert |
Return value | Type | Description |
---|---|---|
<binary-for-input-value> | byte array | The binary version of the specified string |
Example
This example converts the string hello to a binary string:
binary('hello')
And returns the result new byte[] { 104, 101, 108, 108, 111 }.
bool
Return the Boolean version of a value.
bool(<value>)
Parameter | Required | Type | Description |
---|---|---|---|
<value> | Yes | any | The value to convert |
Return value | Type | Description |
---|---|---|
true or false | Boolean | The Boolean version of the specified value |
Example
These examples convert the specified values to Boolean values:
bool(1)
bool(0)
And respectively returns these results:
true
false
ceiling
Return the largest integral value less than or equal to the specified number.
ceiling('<number>')
Parameter | Required | Type | Description |
---|---|---|---|
<number> | Yes | number | An input number |
Return value | Type | Description |
---|---|---|
<integer-value> | integer | The largest integral value greater than or equal to the input number |
Example
This example returns the largest integral value less than or equal to the number 10.333:
ceiling(10.333)
And returns the integer 11.
coalesce
Return the first non-null value from one or more parameters. Empty strings, empty arrays, and empty objects are not null.
coalesce(<object**1>, <object**2>, ...)
Parameter | Required | Type | Description |
---|---|---|---|
<object1> , <object2> , ... | Yes | any | One or more items to check for null. Mixed types are acceptable. |
Return value | Type | Description |
---|---|---|
<first-non-null-item> | any | The first item or value that isn't null. If all parameters are null, this function returns null . |
Example
These examples return the first non-null value from the specified values, or null when all the values are null:
coalesce(null, true, false)
coalesce(null, 'hello', 'world')
coalesce(null, null, null)
And respectively return:
true
- hello
- null
concat
Combine two or more objects, and return the combined objects in a list or string.
concat('<text1>', '<text2>', ...)
Parameter | Required | Type | Description |
---|---|---|---|
<object1> , <object2> ,... | Yes | any | At least two objects to concat. |
Return value | Type | Description |
---|---|---|
`<object1object2...>` | string or list | The combined string or list. Null values are skipped. |
Expected return values:
- If all items are lists, a list will be returned.
- If there exists an item that isn't a list, a string will be returned.
- If a value is null, it's skipped and not concatenated.
Example
This example combines the strings Hello and World:
concat('Hello', 'World')
And returns the result HelloWorld.
Example 2
This example combines the lists [1,2] and [3,4]:
concat([1,2],[3,4])
And returns the result [1,2,3,4].
Example 3
These examples combine objects of different types:
concat('a', 'b', 1, 2)
concat('a', [1,2])
And return the following results respectively:
- The string ab12.
- The object aSystem.Collections.Generic.List 1[System.Object]. This is unreadable and best to avoid.
Example 4
These examples combine objects will null
:
concat([1,2], null)
concat('a', 1, null)
And return the following results respectively:
- The list [1,2].
- The string a1.
contains
Check whether a collection has a specific item. Return true
if the item is found, or return false
if not found. This function is case-sensitive.
contains('<collection>', '<value>')
contains([<collection>], '<value>')
This function works on the following collection types:
- A string to find a substring
- An array to find a value
- A dictionary to find a key
Parameter | Required | Type | Description |
---|---|---|---|
<collection> | Yes | string, array, or dictionary | The collection to check |
<value> | Yes | string, array, or dictionary, respectively | The item to find |
Return value | Type | Description |
---|---|---|
true or false | Boolean | Return true if the item is found. Return false if not found. |
Example 1
This example checks the string hello world for the substring world:
contains('hello world', 'world')
And returns the result true
.
Example 2
This example checks the string hello world for the substring universe:
contains('hello world', 'universe')
And returns the result false
.
count
Return the number of items in a collection.
count('<collection>')
count([<collection>])
Parameter | Required | Type | Description |
---|---|---|---|
<collection> | Yes | string or array | The collection with the items to count |
Return value | Type | Description |
---|---|---|
<length-or-count> | integer | The number of items in the collection |
Examples:
These examples count the number of items in these collections:
count('abcd')
count(createArray(0, 1, 2, 3))
And both return the result 4.
countWord
Return the number of words in a string
countWord('<text>')
Parameter | Required | Type | Description |
---|---|---|---|
<text> | Yes | string | The string to count |
Return value | Type | Description |
---|---|---|
<count> | integer | The number of words in the string |
Example
This example counts the number of words in the string hello world:
countWord("hello word")
And it returns the result 2.
convertFromUTC
Convert a timestamp in an optional locale format from Universal Time Coordinated (UTC) to a target time zone.
convertFromUTC('<timestamp>', '<destinationTimeZone>', '<format>'?, '<locale>'?)
Parameter | Required | Type | Description |
---|---|---|---|
<timestamp> | Yes | string | The string that contains the timestamp |
<destinationTimeZone> | Yes | string | The name of the target time zone. Supports Windows and IANA time zones. |
<format> | No | string | A custom format pattern. Default: "o" format, yyyy-MM-ddTHH:mm:ss.fffffffK , which complies with ISO 8601. |
<locale> | No | string | An optional locale of culture information |
Return value | Type | Description |
---|---|---|
<converted-timestamp> | string | The timestamp converted to the target time zone |
Examples:
These examples convert from UTC to Pacific Standard Time:
convertFromUTC('2018-02-02T02:00:00.000Z', 'Pacific Standard Time', 'MM-DD-YY')
convertFromUTC('2018-02-02T02:00:00.000Z', 'Pacific Standard Time')
And respectively return these results:
- 02-01-18
- 2018-01-01T18:00:00.0000000
Example 2
This example converts a timestamp in the en-US locale from UTC to Pacific Standard Time:
convertFromUTC('2018-01-02T02:00:00.000Z', 'Pacific Standard Time', 'D', 'en-US')
And returns the result Monday, January 1, 2018.
convertToUTC
Convert a timestamp in an optional locale format to Universal Time Coordinated (UTC) from the source time zone.
convertToUTC('<timestamp>', '<sourceTimeZone>', '<format>'?, '<locale>'?)
Parameter | Required | Type | Description |
---|---|---|---|
<timestamp> | Yes | string | The string that contains the timestamp |
<sourceTimeZone> | Yes | string | The name of the source time zone. Supports Windows and IANA time zones. |
<format> | No | string | A custom format pattern. Default: UTC ISO format YYYY-MM-DDTHH:mm:ss.fffZ , which complies with ISO 8601. |
<locale> | No | string | An optional locale of culture information |
Return value | Type | Description |
---|---|---|
<converted-timestamp> | string | The timestamp converted to the target time zone |
Example
This example converts a timestamp to UTC from Pacific Standard Time
convertToUTC('01/01/2018 00:00:00', 'Pacific Standard Time')
And returns the result 2018-01-01T08:00:00.000Z.
Example 2
This example converts a timestamp in the de-DE locale to UTC from Pacific Standard Time:
convertToUTC('01/01/2018 00:00:00', 'Pacific Standard Time', '', 'de-DE')
And returns the result 01.01.18 08:00:00.
createArray
Return an array from multiple inputs.
createArray('<object1>', '<object2>', ...)
Parameter | Required | Type | Description |
---|---|---|---|
<object1> , <object2> ,... | Yes | any, but not mixed | At least two items to create the array |
Return value | Type | Description |
---|---|---|
[<object1> , <object2> , ...] | array | The array created from all the input items |
Example
This example creates an array from the following inputs:
createArray('h', 'e', 'l', 'l', 'o')
And returns the result [h ,e, l, l, o].
dataUri
Return a data uniform resource identifier (URI) of a string.
dataUri('<value>')
Parameter | Required | Type | Description |
---|---|---|---|
<value> | Yes | string | The string to convert |
Return value | Type | Description |
---|---|---|
[<date-uri> ] | string | The data URI for the input string |
Example
dataUri('hello')
Returns the result data:text/plain;charset=utf-8;base64,aGVsbG8=.
dataUriToBinary
Return the binary version of a data uniform resource identifier (URI).
dataUriToBinary('<value>')
Parameter | Required | Type | Description |
---|---|---|---|
<value> | Yes | string | The data URI to convert |
Return value | Type | Description |
---|---|---|
[<binary-for-data-uri >] | byte array | The binary version of the data URI |
Example
This example creates a binary version for the following data URI:
dataUriToBinary('aGVsbG8=')
And returns the result new byte[] { 97, 71, 86, 115, 98, 71, 56, 61 }.
dataUriToString
Return the string version of a data uniform resource identifier (URI).
dataUriToString('<value>')
Parameter | Required | Type | Description |
---|---|---|---|
<value> | Yes | string | The data URI to convert |
Return value | Type | Description |
---|---|---|
[<string-for-data-uri> ] | string | The string version of the data URI |
Example
This example creates a string from the following data URI:
dataUriToString('data:text/plain;charset=utf-8;base64,aGVsbG8=')
And returns the result hello.
date
Return the date of a specified timestamp in m/dd/yyyy format.
date('<timestramp>')
Parameter | Required | Type | Description |
---|---|---|---|
<timestamp> | Yes | string | The string that contains the timestamp |
Return value | Type | Description |
---|---|---|
<date> | string | The date of the specified timestamp |
date('2018-03-15T13:00:00.000Z')
Returns the result 3-15-2018.
dateReadBack
Uses the date-time library to provide a date readback.
dateReadBack('<currentDate>', '<targetDate>')
Parameter | Required | Type | Description |
---|---|---|---|
<currentDate> | Yes | string | The string that contains the current date |
<targetDate> | Yes | string | The string that contains the target date |
Return value | Type | Description |
---|---|---|
<date-readback> | string | The readback between current date and the target date |
Example 1
dateReadBack('2018-03-15T13:00:00.000Z', '2018-03-16T13:00:00.000Z')
Returns the result tomorrow.
dateTimeDiff
Return the difference in ticks between two timestamps.
dateTimeDiff('<timestamp1>', '<timestamp2>')
Parameter | Required | Type | Description |
---|---|---|---|
<timestamp1> | Yes | string | The first timestamp string to compare |
<timestamp2> | Yes | string | The second timestamp string to compare |
Return value | Type | Description |
---|---|---|
<ticks> | number | The difference in ticks between two timestamps |
Example 1
This example returns the difference in ticks between two timestamps:
dateTimeDiff('2019-01-01T08:00:00.000Z','2018-01-01T08:00:00.000Z')
And returns the number 315360000000000.
Example 2
This example returns the difference in ticks between two timestamps:
dateTimeDiff('2018-01-01T08:00:00.000Z', '2019-01-01T08:00:00.000Z')
Returns the result -315360000000000. The value is a negative number.
dayOfMonth
Return the day of the month from a timestamp.
dayOfMonth('<timestamp>')
Parameter | Required | Type | Description |
---|---|---|---|
<timestamp> | Yes | string | The string that contains the timestamp |
Return value | Type | Description |
---|---|---|
<day-of-month> | integer | The day of the month from the specified timestamp |
Example
This example returns the number for the day of the month from the following timestamp:
dayOfMonth('2018-03-15T13:27:36Z')
And returns the result 15.
dayOfWeek
Return the day of the week from a timestamp.
dayOfWeek('<timestamp>')
Parameter | Required | Type | Description |
---|---|---|---|
<timestamp> | Yes | string | The string that contains the timestamp |
Return value | Type | Description |
---|---|---|
<day-of-week> | integer | The day of the week from the specified timestamp. Sunday is 0, Monday is 1, and so forth. |
Example
This example returns the number for the day of the week from the following timestamp:
dayOfWeek('2018-03-15T13:27:36Z')
And returns the result 3.
dayOfYear
Return the day of the year from a timestamp.
dayOfYear('<timestamp>')
Parameter | Required | Type | Description |
---|---|---|---|
<timestamp> | Yes | string | The string that contains the timestamp |
Return value | Type | Description |
---|---|---|
<day-of-year> | integer | The day of the year from the specified timestamp |
Example
This example returns the number of the day of the year from the following timestamp:
dayOfYear('2018-03-15T13:27:36Z')
And returns the result 74.
div
Return the integer result from dividing two numbers. To return the remainder see mod().
div(<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 |
---|---|---|
<quotient-result> | number | The result from dividing the first number by the second number |
Example
Both examples divide the first number by the second number:
div(10, 5)
div(11, 5)
And return the result 2.
There exists some gap between Javascript and .NET SDK. For example, the following expression will return different results in Javascript and .NET SDK:
If one of the parameters is a float, the result will also be a FLOAT with .NET SDK.
Example
div(11.2, 2)
Returns the result 5.6.
If one of the parameters is a float, the result will be an INT with Javascript SDK.
Example
div(11.2, 2)
Returns the result 5.
The workaround for Javascript to keep a certain number of decimal places in results is to use such expression. For example, to keep 3 decimal places:
float(concat(string(div(a, b)),'.',string(mod(div(a*1000, b), 1000))))
Updated about 1 month ago