Custom Functions

There are in excess of 100 custom functions built in to the framework.

Usage

Not all API’s support the use of custom functions. Those that support their use are:

API
Expert
Transform
XmlToJson

Note: The namespace ado should be prefixed against each call to each function, e.g. ado:DateTimeParseExact

The full glossary of all supported functions is listed below.

String
Math
Date/Time
Conversion
Special

Concat / Concatenate

Concatenates exactly two strings together.

ParameterTypeDescription
value1StringFirst string to concatenate.
value2StringSecond string to concatenate.

Example

https://docs.microsoft.com/en-us/dotnet/api/system.string.concat

Concat(Concat([Text1], ' '), [Text2])Code language: JavaScript (javascript)

Input

[Text1] = This is
[Text2] = a test

Output

This is a test

Contains

Determines if one string contains another.

ParameterTypeDescription
valueStringTo string to search within.
searchForStringThe string to search for.
ignoreCaseBooleantrue = ignore the case sensitivity of the value.
false = honour the case sensitivity of the value.

Example

https://docs.microsoft.com/en-us/dotnet/api/system.string.contains

Contains([Text], 'Test', true)Code language: JavaScript (javascript)

Input

This is a test

Output

trueCode language: JavaScript (javascript)

EndsWith

Determines if a string ends with another string.

ParameterTypeDescription
valueStringTo string to search within.
searchForStringThe string to search for.
ignoreCaseBooleantrue = ignore the case sensitivity of the value.
false = honour the case sensitivity of the value.

Example

https://docs.microsoft.com/en-us/dotnet/api/system.string.endswith

EndsWith([Text], 'Test', true)Code language: JavaScript (javascript)

Input

This is a test

Output

trueCode language: JavaScript (javascript)

Format

Formats a number using syntax similar to that which is supported by Excel.

ParameterTypeDescription
valueNumberThe value to format.
formatStringExcel format string.

Note: There is no guarantee that the framework will support all formats that work in Excel but testing has shown that the majority of the most common ones do.

Example

Format([Value], '$#,##0.00')Code language: JavaScript (javascript)

Input

10000.00Code language: CSS (css)

Output

$10,000.00

Guid

Returns a new Guid.

Example

Guid()

Input

N/A

Output

f272d1a4-c69d-4830-90e8-d896a46a5fe5

Length

Returns the length of a string.

ParameterTypeDescription
valueStringTo string to retrieve the length for.

Example

https://docs.microsoft.com/en-us/dotnet/api/system.string.length

Length([Text])Code language: CSS (css)

Input

This is a test

Output

14

Lower

Transforms the case of any given text to be all lower case.

ParameterTypeDescription
valueStringThe text to transform to lower case.

Example

https://docs.microsoft.com/en-us/dotnet/api/system.string.tolower

Lower([Text])Code language: CSS (css)

Input

ThIs Is A tEsT

Output

this is a testCode language: JavaScript (javascript)

Mid

Retrieves a substring from another string.

ParameterTypeDescription
valueStringTo string to execute the replace function over.
startIndexIntegerThe start position, 1 being the first.
lengthIntegerThe amount of characters to return from the start index, 0 will continue to the end of the string.

Example

Mid([Text], 10, 0)Code language: CSS (css)

Input

This is a test

Output

test

PadLeft

Adds leading characters to a string.

ParameterTypeDescription
valueStringTo string to add the leading characters to.
paddingCharacterCharThe character to add.
totalWidthIntegerThe total width the result should be after the leading characters have been added.

Example

https://docs.microsoft.com/en-us/dotnet/api/system.string.padleft

PadLeft([Text], '0', 10)Code language: JavaScript (javascript)

Input

1000

Output

0000001000

PadRight

Adds trailing characters to a string.

ParameterTypeDescription
valueStringTo string to add the trailing characters to.
paddingCharacterCharThe character to add.
totalWidthIntegerThe total width the result should be after the trailing characters have been added.

Example

https://docs.microsoft.com/en-us/dotnet/api/system.string.padright

PadRight([Text], '0', 10)Code language: JavaScript (javascript)

Input

0001

Output

0001000000

Proper

Will set the text for any given string to “proper” case.

ParameterTypeDescription
valueStringThe text to make “proper”.

Example

https://docs.microsoft.com/en-us/dotnet/api/system.globalization.textinfo.totitlecase

Proper([Text])Code language: CSS (css)

Input

this is a testCode language: JavaScript (javascript)

Output

This Is A Test

RemoveLeadingZeros

Removes the leading zeros of the value provided.

ParameterTypeDescription
valueStringThe value to remove the leading zeros from.

Example

RemoveLeadingZeros([CostCenter])Code language: CSS (css)

Input

0000001000

Output

1000

RegexCount

Returns the amount of occurrences a regex pattern matches a string.

ParameterTypeDescription
valueStringTo string to execute the regular expression over.
patternStringThe regex pattern.

Note: Passing regex statements through JSON requires that it be properly encoded, therefore, this property accepts either the pattern base64 encoded, or the pattern itself.

Notes

Regex patterns are able to be passed as a base64 string or as a plain text encoded string that is acceptable to the JSON format.

The base64 string passed in as the pattern, when decoded, equals …

^[\w-.]+@([\w-]+.)+[\w-]{2,4}$

… if the string weren’t base64 encoded, then it would need to be encoded for JSON and therefore, look like this …

^[\\w-.]+@([\\w-]+.)+[\\w-]{2,4}$

Different regex expressions will require various amounts of complexity when encoding but the framework does allow for both approaches which provides you with options when using this function.

Example

The example below is taken directly from the Microsoft documentation. Please refer to this link for more information and more examples.

https://docs.microsoft.com/en-us/dotnet/standard/base-types/quantifiers-in-regular-expressions

RegexCount([Text], '\\b91*9*\\b')Code language: JavaScript (javascript)

Input

99 95 919 929 9119 9219 999 9919 91119

Output

5

RegexMatch

Determines if a string matches the regex pattern supplied.

ParameterTypeDescription
valueStringTo string to execute the regular expression over.
patternStringThe regex pattern.

Note: Passing regex statements through JSON requires that it be properly encoded, therefore, this property accepts either the pattern base64 encoded, or the pattern itself.

Notes

Regex patterns are able to be passed as a base64 string or as a plain text encoded string that is acceptable to the JSON format.

The base64 string passed in as the pattern, when decoded, equals …

^[\w-.]+@([\w-]+.)+[\w-]{2,4}$

… if the string weren’t base64 encoded, then it would need to be encoded for JSON and therefore, look like this …

^[\\w-.]+@([\\w-]+.)+[\\w-]{2,4}$

Different regex expressions will require various amounts of complexity when encoding but the framework does allow for both approaches which provides you with options when using this function.

Example

This example demonstrates a regex pattern checking to ensure an email address matches the generic structure expected (i.e. no space, @ symbol, .com etc.)

RegexMatch([Text], 'Xltcdy1cLl0rQChbXHctXStcLikrW1x3LV17Miw0fSQ=')Code language: JavaScript (javascript)

Input

support@statesolutions.com.auCode language: CSS (css)

Output

TrueCode language: PHP (php)

RegexReplace

Replaces all occurrences of the regex pattern results with a replacement string.

ParameterTypeDescription
valueStringTo string to execute the regular expression over.
patternStringThe regex pattern.

Note: Passing regex statements through JSON requires that it be properly encoded, therefore, this property accepts either the pattern base64 encoded, or the pattern itself.
replaceWithStringThe replacement string.

Notes

Regex patterns are able to be passed as a base64 string or as a plain text encoded string that is acceptable to the JSON format.

The base64 string passed in as the pattern, when decoded, equals …

^[\w-.]+@([\w-]+.)+[\w-]{2,4}$

… if the string weren’t base64 encoded, then it would need to be encoded for JSON and therefore, look like this …

^[\\w-.]+@([\\w-]+.)+[\\w-]{2,4}$

Different regex expressions will require various amounts of complexity when encoding but the framework does allow for both approaches which provides you with options when using this function.

Example

This example demonstrates a regex pattern that replaces all characters that are not numeric or alpha with a hyphen.

RegexReplace([Text], '[^0-9a-zA-Z]+', '-')Code language: JavaScript (javascript)

Input

Replace all special . characters @ with a hyphen*Code language: JavaScript (javascript)

Output

Replace-all-special-characters-with-a-hyphen-Code language: JavaScript (javascript)

Replace

Replaces all occurrences of text within a string, with another string.

ParameterTypeDescription
valueStringTo string to execute the replace function over.
oldValueStringThe value to replace.
newValueStringThe value that oldValue will be replaced with.
ignoreCaseBooleantrue = ignore the case sensitivity of the value.
false = honour the case sensitivity of the value.

Example

https://docs.microsoft.com/en-us/dotnet/api/system.string.replace

Replace([Text], ' a ', ' a successful ', true)Code language: JavaScript (javascript)

Input

This is a test

Output

This is a successful test

Reverse

Reverses a string.

ParameterTypeDescription
valueStringThe text to reverse.

Example

Reverse([Text])Code language: CSS (css)

Input

This is a test

Output

tset a si sihT

StartsWith

Determines if a string starts with another string.

ParameterTypeDescription
valueStringTo string to search within.
searchForStringThe string to search for.
ignoreCaseBooleantrue = ignore the case sensitivity of the value.
false = honour the case sensitivity of the value.

Example

https://docs.microsoft.com/en-us/dotnet/api/system.string.startswith

StartsWith([Text], 'This', true)Code language: JavaScript (javascript)

Input

This is a test

Output

trueCode language: JavaScript (javascript)

Trim

Trims all leading and trailing spaces.

ParameterTypeDescription
valueStringThe text to trim.

Example

https://docs.microsoft.com/en-us/dotnet/api/system.string.trim

Trim([Text])Code language: CSS (css)

Input (quotes encapsulated to show start and end of text)

"    Test    "Code language: JSON / JSON with Comments (json)

Output (quotes encapsulated to show start and end of text)

"Test"Code language: JSON / JSON with Comments (json)

TrimEnd

Trims all trailing spaces.

ParameterTypeDescription
valueStringThe text to trim.

Example

https://docs.microsoft.com/en-us/dotnet/api/system.string.trimend

TrimEnd([Text])Code language: CSS (css)

Input (quotes encapsulated to show start and end of text)

"    Test    "Code language: JSON / JSON with Comments (json)

Output (quotes encapsulated to show start and end of text)

"    Test"Code language: JSON / JSON with Comments (json)

TrimStart

Trims all leading spaces.

ParameterTypeDescription
valueStringThe text to trim.

Example

https://docs.microsoft.com/en-us/dotnet/api/system.string.trimstart

TrimStart([Text])Code language: CSS (css)

Input (quotes encapsulated to show start and end of text)

"    Test    "Code language: JSON / JSON with Comments (json)

Output (quotes encapsulated to show start and end of text)

"Test    "Code language: JSON / JSON with Comments (json)

Upper

Transforms the case of any given text to be all upper case.

ParameterTypeDescription
valueStringThe text to transform to upper case.

Example

https://docs.microsoft.com/en-us/dotnet/api/system.string.toupper

Upper([Text])Code language: CSS (css)

Input

ThIs Is A tEsT

Output

THIS IS A TEST