SQUIZZ.com
Loading interface, please wait...
Interface taking a long time to load?
Check your internet connection is up, and you're using the latest app/browser version.

JSON XML CSV Data Field Functions

ARRAY_LENGTH(json_path, parent_count)

Description: Returns the number of values that are stored within a specified JSON array, or in an array accessible from a parent object further up in the JSON tree. If no array can be found then it returns -1
Arguments

The function takes 2 arguments:
json_path: Set the path and name to the JSON array from the record being processed, or from a parent record found using the parent_count argument.
parent_count: Set the number of steps to navigate up the JSON tree from the position of the record being processed to navigate from using the JSON path. This allows traversal up the JSON tree to find arrays and its length.

Output: NUMBER
Examples

Below is an example of JSON data obtained in entirety from a data source for a given data export.

{
    "sizes":
    [
        {
            "size":"small",
            "colours": ["green","red","blue"],
        },
        {
            "size":"medium",
            "colours": ["purple","red","orange","brown"],
        },
        {
            "size":"large",
            "colours": ["purple","green","yellow"],
        }
    ]
}

If the JSON RecordSet Path is set to $ then the following will be outputted:

ARRAY_LENGTH('sizes','0')
Output: 3

If the JSON RecordSet Path is set to sizes[*] then the following will be outputted:

ARRAY_LENGTH('colours','0')
Record 1 Output: 3
Record 2 Output: 4
Record 3 Output: 3
 

For each record found with the sizes[*] path in the function below it first traverses up the JSON tree (3 steps) then obtains length in a parent object's "sizes" array.

ARRAY_LENGTH('sizes','3')
Record 1 Output: 3
Record 2 Output: 3
Record 3 Output: 3

ARRAY_VALUE_JOIN(json_path, parent_count, delimiter)

Description: Joins the values together that are stored within a JSON array, where the array can found within the current record being processed, or in parent objects further up the JSON tree. Delimiting text can be set that is placed inbetween each joined array value.
Arguments

The function takes 3 arguments:
json_path: Set the path and name to the JSON array from the record being processed, or from a parent record found using the parent_count argument.
parent_count: Set the number of steps to navigate up the JSON tree from the position of the record being processed to navigate from using the JSON path. This allows traversal up the JSON tree to find arrays in parent objects.
delimiter: Set the text that will be placed in between each value obtained from the array.

Output: STRING
Examples

Below is an example of JSON data obtained in entirety from a data source for a given data export.

{
    "sizes":
    [
        {
            "size":"small",
            "colours": ["green","red","blue"],
        },
        {
            "size":"medium",
            "colours": ["purple","red","orange"],
        },
        {
            "size":"large",
            "colours": ["purple","green","yellow"],
        }
    ]
}

If the JSON RecordSet Path is set to $ then the following will be outputted:

ARRAY_VALUE_JOIN('sizes[*].size','0',',')
Output: 'small,medium,large'

This function will ignore outputting the array value 'small' with the other values.

ARRAY_VALUE_JOIN('sizes[?(@.size != 'small')].size','0',',')
Output: 'medium,large'

If the JSON RecordSet Path is set to sizes[*] then the following will be outputted:

ARRAY_VALUE_JOIN('colours[*]','0',' and ')
Record 1 Output: 'green and red and blue'
Record 2 Output: 'purple and red and orange'
Record 3 Output: 'purple and green and yellow'

The function below will only find and output values in the array that are purple or yellow:
ARRAY_VALUE_JOIN("colours[?(@ == 'purple' || @=='yellow')]",'0',' + ')
Record 1 Output: ''
Record 2 Output: 'purple'
Record 3 Output: 'purple + yellow'

For each record found with the sizes[*] path in the function below it first traverses up the JSON tree (3 steps) then joins values in a parent object's "sizes" array.

ARRAY_VALUE_JOIN('sizes[*].size','3',' or ')
Record 1 Output: 'small or medium or large'
Record 2 Output: 'small or medium or large'
Record 3 Output: 'small or medium or large'

CALC(arg1, arg2, arg..n)

Description: Calculates out a numeric value after evaluating out all arguments into a string representation of a mathematical equation. 
Arguments

The function can take 1 or more arguments with each argument either the name of a JSON field in the record, or literal text enclosed with either single quote or double quote characters. The output of each argument is joined together to make one final mathematical equation which is evaluated out. The mathematical operators supported are + - / % ( )

Output: NUMBER
Examples

CALC('((10 + 4 - 2) / 2) * 6')
outputs: 36

CALC(TaxRate,' + 33')
TaxRate = 10
outputs: 43

CALC(CONCAT('10','00'),'/',Amount)
Amount = 50000
outputs = 0.02

CONTROL_CHAR(input_arg)

Description: Returns text containing the original text inputted, replacing \n \r and \t character sequences with new line, carriage return, tab characters.
Arguments

The function takes 1 argument:
input_arg: the field name or literal text to read in and replace control characters with.

Output: STRING
Examples

CONTROL_CHAR('today\t we will code')
outputs: today      we will code

CONTROL_CHAR('today\t we\twill code')
outputs: today      we    will code

CONTROL_CHAR('example\r\ntext')
outputs: example
text

CONCAT(arg1, arg2, arg..n)

Description: Allows one or more fields in the same record to be joined to another field or literal text, and outputs the joined text.
Arguments The function can take 1 or more arguments with each argument either the name of a JSON field in the record, or literal text enclosed with either single quote or double quote characters.

Note: Ensure that each argument doesn't start with space, new line, or special characters or otherwise the function will not be able to evaluate out a value and throw an exception. If a json field name contains space or special characters then use square brackets and enclosing characters to set the name of the field's key.
Output: STRING
Examples

CONCAT(Taxcode,'1234')
Taxcode = 'GST'
outputs: GST1234

CONCAT('ABC',REPLACE('DEF','E','1'),'GHI')
outputs: ABCD1FGHI

CONCAT(['Taxcode 1'],'1234')
Taxcode 1 = 'GST'
outputs: GST1234

DATESTR_CONVERT(input_arg, date_format, output_type)

Description: Converts a date time string into different date format.
Arguments

The function takes the following 3 arguments:
input_arg: the field name or literal text to read in that contains the date value.
date_format: the field name or literal text that contains text on how the input text has its date format parsed. This date format should conform to the Dot.NET language's date format conventions or otherwise have the value 'LONG' set to denote that the value in the input_arg is a long integer (64bit integer) that stores the amount of milliseconds past since the 1970-01-01 12am UTC date time epoch.
output_type: Set to 'LONG' or otherwise place a date format string that conforms to the Dot.NET language's date format conventions. If Set to LONG then the datetime value read in will be converted to a long integer number that represents the amount of milliseconds past since the 1970-01-01 12am UTC date time epoch. If set to a date format string then the datetime value will be formatted to text with the date in the local time zone that is set for the computer that the Connector is installed on.

Output: NUMBER or STRING
Examples

First example converts date time text (in the local time zone) into a long integer that displays the amount of seconds since the 1970-01-01 12am UTC epoch (also known as unix time).

DATESTR_CONVERT('14/07/2016 21:14:48','dd/MM/yyyy HH:mm:ss','LONG')

outputs: 1468530888000

Second example converts a long integer number storing the amount of milliseconds since the 1970-01-01 12am UTC epoch into formatted date time text in the local time zone.

DATESTR_CONVERT('1468530888000','LONG','dd/MM/yyyy HH:mm:ss')
outputs: 14/07/2016 21:14:48

Third example converts date time formatted text into date only formatted text.

DATESTR_CONVERT('14/07/2016 21:14:48','dd/MM/yyyy HH:mm:ss','dd-MM-yy')
outputs: 14-07-16

Fourth example converts date time formatted text into time only formatted text.

DATESTR_CONVERT('14/07/2016 21:14:48','dd/MM/yyyy HH:mm:ss','HH:mm:ss')
outputs: 21:14:48

Fifth example converts a date time formatted text into a date time formatted text with day and month names, with time shown as a 12 hour clock

DATESTR_CONVERT('14/07/2016 21:14:48','dd/MM/yyyy HH:mm:ss','dddd dd MMMM yyyy hh:mm tt')
outputs: Thursday 14 July 2016 09:14 PM

DATETIME_NOW()

Description: Returns the current date time in the form of milliseconds since the 01/01/1970 12am UTC epoch, also known as UNIX time.
Arguments

The function takes no arguments

Output: NUMBER
Examples

In this first example if the current date time was Thursday July 26 2018 08:43:04 in the UTC time zone then it would return the date time as the shown number.

DATETIME_NOW()

outputs: 1532594584921

In this second example the function is used with the DATESTR_CONVERT function to format the current date time as formatted text (if the current date time was Friday July 15 2016 07:14:48 AEST)

DATESTR_CONVERT(DATETIME_NOW(),'LONG','dd/MM/yyyy HH:mm:ss')

outputs: 15/07/2016 07:14:48

DECODE(input_arg, decoding_type)

Description: Decodes the text given the first argument, un-escaping or reverted encoded characters in the text to its original form, based on the data type specified.
Arguments

The function takes 2 arguments:
input_arg: the field name or literal text to read in and decode.
encoding_type: set to one of the following:

  • XML
    Replaces encoded XML or HTML characters to the original text form, such as changing &gt characters to >; and & to &
  • JSON
    Removes characters that are used for escaping within JSON data, such as replacing " to "
  • BASE64
    Decodes text encoded in base64 to its original text form.
  • URL
    Replaces encoded chracters within URL text, such as replacing the %2F characters with a / slash character
  • SQL_SINGLE_QUOTE
    Removes characters that are used for escaping within SQL data with text wrapped in single quotes, such as replacing ' to '
  • SQL_DOUBLE_QUOTE
    Removes characters that are used for escaping within SQL data with text wrapped in double quotes, such as replacing " to '
Output: STRING
Examples

 

DECODE(exampleText,'XML')
exampleText = 'This is an "example" string /with data/ 'and' <other> text!'
outputs: 'This is an "example" string /with data/ 'and' <other> text!'
 
DECODE(exampleText,'JSON')
exampleText = 'This is an \"example\" string /with data/ 'and' <other> text!'
outputs: 'This is an "example" string /with data/ 'and' <other> text!'
 
DECODE(exampleText,'BASE64')
exampleText = ''VGhpcyBpcyBhbiAiZXhhbXBsZSIgc3RyaW5nIC93aXRoIGRhdGEvICdhbmQnIDxvdGhlcj4gdGV4dCE='
outputs: 'This is an "example" string /with data/ 'and' <other> text!'
DECODE(exampleText,'URL')
exampleText = 'This+is+an+%22example%22+string+%2fwith+data%2f+%27and%27+%3cother%3e+text!'
outputs: 'This is an "example" string /with data/ 'and' <other> text!'
DECODE(exampleText,'SQL_SINGLE_QUOTE')
exampleText = 'This is an "example" string /with data/ \'and\' <other> text!'
outputs: 'This is an "example" string /with data/ 'and' <other> text!'
DECODE(exampleText,'SQL_DOUBLE_QUOTE')
exampleText = 'This is an \"example\" string /with data/ 'and' <other> text!'
outputs: 'This is an "example" string /with data/ 'and' <other> text!'

 

ENCODE(input_arg, enocding_type)

Description: Encodes the text given the first argument, escaping, replacing or encrypting specific characters in the text to ensure the text can be properly handled with the specified data type.
Arguments

The function takes 2 arguments:
input_arg: the field name or literal text to read in and encode.
encoding_type: set to one of the following:

  • XML
    Replaces characters that would cause XML or HTML markup to break, such as changing > character to &gt; and & to &amp;
  • JSON
    Replaces characters that would cause JSON data to break, such as escaping " characters with "
  • BASE64
    Encodes the text into a Base 64 text string.
  • URL
    Replaces characters to allow literal text to be placed wihtin a URL, such as replacing forward slash characters with %2f. Note that any encoded characters will contain letters in lowercase
  • URL_UPPERCASE
    Replaces characters to allow literal text to be placed wihtin a URL, such as replacing forward slash characters with %2F. Note that any encoded characters will contain letters in uppercase.
  • SQL_SINGLE_QUOTE
    Replaces characters that allow text to be set within single quotes of an SQL query, esaping slash characters and single quote characters
  • SQL_DOUBLE_QUOTE
    Replaces characters that allow text to be set within double quotes of an SQL query, esaping slash characters and double quote characters
  • SHA1
    Converts characters into scrambled text using the Secure Hash Algorithm 1 (SHA-1) cryptographic hash function. This scrambled text cannot be decrypted (i.e. one way encryption).
  • SHA256
    Converts characters into scrambled text using the Secure Hash Algorithm 2 (SHA-2) cryptographic hash function 256bits in size. This scrambled text cannot be decrypted (i.e. one way encryption).
Output: STRING
Examples

ENCODE(exampleText,'XML')
exampleText = 'This is an "example" string /with data/ 'and' <other> text!'
outputs: 'This is an &quot;example&quot; string /with data/ &#39;and&#39; &lt;other&gt; text!'

ENCODE(exampleText,'JSON')
exampleText = 'This is an "example" string /with data/ 'and' <other> text!'
outputs: 'This is an \"example\" string /with data/ 'and' <other> text!'

ENCODE(exampleText,'BASE64')
exampleText = 'This is an "example" string /with data/ 'and' <other> text!'
outputs: 'VGhpcyBpcyBhbiAiZXhhbXBsZSIgc3RyaW5nIC93aXRoIGRhdGEvICdhbmQnIDxvdGhlcj4gdGV4dCE='

ENCODE(exampleText,'URL')
exampleText = 'This is an "example" string /with data/ 'and' <other> text!'
outputs: 'This+is+an+%22example%22+string+%2fwith+data%2f+%27and%27+%3cother%3e+text!'

ENCODE(exampleText,'URL_UPPERCASE')
exampleText = 'This is an "example" string /with data/ 'and' <other> text!'
outputs: 'This+is+an+%22example%22+string+%2Fwith+data%2F+%27and%27+%3cother%3E+text!'

ENCODE(exampleText,'SQL_SINGLE_QUOTE')
exampleText = 'This is an "example" string /with data/ 'and' <other> text!'
outputs: 'This is an "example" string /with data/ 'and\' <other> text!'

ENCODE('example plaintext data','SHA1')
outputs: 'b3b78263aa83847585cf24fa1567e82744578777'

ENCODE('example plaintext data','SHA256')
outputs: 'f455a4040a94d1a732427f86838728dca551642a2efc9e02d70a1a2595bcf4eb'

ENCRYPT(input_arg, encryption_method, private_key, public_key)

Description: Encrypts the text given in the first argument into jumbled text that cannot be read by any other parties without holding keys to decrypt the jumbled text. The function supports encrypting text using several different cryprography ciphers, allowing the plain text to be encrypted in different ways to greater or lesser security extents.
Arguments

The function takes 4 arguments:
input_arg: the field name or literal text to read in and encrypt.
encryption_method: set to one of the following:

  • RSA-SHA1-SIGN
    Converts characters into scrambled text using the Secure Hash Algorithm 1 (SHA-1) cryptographic hash function. Then encrypts the hash'd text with the 2048 bit RSA private key provided to a generate signed encrypted text. Note that this signed encrypted cannot be decrypted, instead it can only verified by another party that contains the RSA public key. You can use tools such as OpenSSL to generate private and public RSA keys. Only private key needs to be set in function for this method and the public key argument can be left empty.
  • RSA-SHA256-SIGN
    Converts characters into scrambled text using the Secure Hash Algorithm 2 (SHA-2) cryptographic hash function 256 bits in size. Then encrypts the hash'd text with the 2048 bit RSA private key provided to generate a signed encrypted text. Note that this signed encrypted cannot be decrypted, instead it can only verified by another party that contains the RSA public key. You can use tools such as OpenSSL to generate private and public RSA keys. Only private key needs to be set in function for this method and public key argument can be left empty.
  • RSA-SHA384-SIGN
    Converts characters into scrambled text using the Secure Hash Algorithm 2 (SHA-2) cryptographic hash function 384 bits in size. Then encrypts the hash'd text with the 2048 bit RSA private key provided to generate a signed encrypted text. Note that this signed encrypted cannot be decrypted, instead it can only verified by another party that contains the RSA public key. You can use tools such as OpenSSL to generate private and public RSA keys. Only private key needs to be set in function for this method and the public key argument can be left empty.
  • RSA-SHA512-SIGN
    Converts characters into scrambled text using the Secure Hash Algorithm 2 (SHA-2) cryptographic hash function 512 bits in size. Then encrypts the hash'd text with the 2048 bit RSA private key provided to generate a signed encrypted text. Note that this signed encrypted cannot be decrypted, instead it can only verified by another party that contains the RSA public key. You can use tools such as OpenSSL to generate private and public RSA keys. Only private key needs to be set in function for this method and the public key argument can be left empty.
  • RSA-MD5-SIGN
    Converts characters into scrambled text using the MD5 cryptographic hash function 128 bits in size. Then encrypts the hash'd text with the 2048 bit RSA private key provided to generate a signed encrypted text. Note that this signed encrypted cannot be decrypted, instead it can only verified by another party that contains the RSA public key. You can use tools such as OpenSSL to generate private and public RSA keys. Only the private key needs to be set in function for this method and the public key argument can be left empty.

private_key: Text that contains the private key that may be used to encrypt the plain text data specified in the input arg. The private key may need to conform to certain structure based on the encryption_method set to encrypt the plain text.
public_key: Text that contains the public key that may be used to encrypt the plain text data specified in the input arg. The public key may need to conform to certain structure based on the encryption_method set to encrypt the plain text.

Output: STRING
Examples

Example returns text encrypted and signed using the RSA SHA1 cipher. Note that the private key and output text have been cut off for brevity.

ENCRYPT('test-data','RSA-SHA1-SIGN','MIIEogIBAAKCAQEAs5xknGX...','')
returns: GtGr47BGtY1k1lgb5p7w7SrIrvhLfZoVDhv4EsjqJPCcZvV831t/7idikVvPB2D7wR...

Example returns text encrypted and signed using the RSA SHA256 cipher. Note that the private key and output text have been cut off for brevity.

ENCRYPT('test-data','RSA-SHA256-SIGN','MIIEogIBAAKCAQEAs5xknGX...','')
returns: ZFGmbfUE9Pmrp/FPgx4eX0//7JIVk68mne0jRnK7suDRKn6Vth/kg9nws1+Xbq0tgSsHYU5pLfObCWmPE...

Example returns text encrypted and signed using the RSA SHA384 cipher. Note that the private key and output text have been cut off for brevity.

ENCRYPT('test-data','RSA-SHA384-SIGN','MIIEogIBAAKCAQEAs5xknGX...','')
returns: rYI2n2WuqYOwdOqqu/wD7KMp4vnc+AlQqKViA2iHg7v3kaecB6Tt/i3cng42qYx7x00...

Example returns text encrypted and signed using the RSA SHA512 cipher. Note that the private key and output text have been cut off for brevity.

ENCRYPT('test-data','RSA-SHA512-SIGN','MIIEogIBAAKCAQEAs5xknGX...','')
returns: cRHUs8DZ2L4PaMXnP7IoQMDTv5IqRvm+YkoiahPUSzoRSTuWdqjsOpQ...

Example returns text encrypted and signed using the RSA MD5 cipher. Note that the private key and output text have been cut off for brevity.

ENCRYPT('test-data','RSA-MD5-SIGN','MIIEogIBAAKCAQEAs5xknGX...','')
returns: BTukqWW7BYPNbMQCWLQEyN7S4w0UvyEg1qWdL11HdVsCSfU1tLN...

HASH_MAC(input_arg, secret_key, hash_cipher)

Description: Generates a Hash based Message Authentication Code (HMAC), which consists of text that has been combined with a provided secret key, then scrambled using a hashing function (a one way cryptograhic cipher). This HMAC is typically used to authenticate or login to web services and other systems to gain access to data. This function can generate a HMAC using either the SHA1, SHA256, SHA512, or MD5 hashing functions/ciphers.
The generated hash is encoded as a base 64 string. Note that all text passed in the function will be treated as UTF-8 text strings.
Arguments

The function takes 3 arguments:
input_arg: The field name or literal text to read in and hash/scramble
secret_key: The field name or literal text that contains the secret key that is scrambled with the input_arg.
hash_cipher: The hashing function/cipher that is used to do the hashing/scrambling of the text. Set it to either SHA1, SHA256, SHA512, MD5

Output: STRING
Examples

Example returns text hashed using the SHA1 cipher

HASH_MAC('exampletext','secret_key','SHA1')
returns: 23ba96518eb510692627ff40a6a6053c91f1fb953ac0d9c96ccfef75e471dd8c

Example returns text hashed using the SHA2 (256bit) cipher

HASH_MAC('exampletext','secret_key','SHA256')
returns: 23ba96518eb510692627ff40a6a6053c91f1fb953ac0d9c96ccfef75e471dd8c

Example returns text hashed using the SHA2 (512bit) cipher

HASH_MAC('exampletext','secret_key','SHA512')
returns: 8b30b73a9f2230d2be4874f24167fb2be94cb802bc7cf44266d9d5942e54843da775fe809aeb446a44d3b4aca15a07c4ab11c00b8cd93589a59fabd07c58f45c

Example returns text hashed using the MD5 cipher

HASH_MAC('exampletext','secret_key','MD5')
returns: 8090628f8676748b6b334bb3ad887c21

IF(compare_arg1, operator, comprare_arg2, then_arg, else_arg)

Description: Checks if one value matches another value, then if so outputs one value, otherwise it outputs the other value.
Arguments

The function takes 5 arguments:
compare_arg1: The first field name or literal text to read in and compare against the second
compare_arg2: The second field name or literal text to read in and compare against the first
then_arg: Name of the JSON field in the record or literal text to be outputted when the comparing arguments match
else_arg: Name of the JSON field in the record or literal text to be outputted when the comparing arguments fail to match
operator: Operator used to compare the two arguments. must be set to one of the following

  • ==S
    Checks if both values match each other, character for character in each value's string
  • ==N
    Checks if both values match each other numerically. Each value must evaluate out to a number first.
  • !=S
    Checks if both values do not match each other, character for character in each value's string
  • !=N
    Checks if both values do not match each other numerically after each value has been converted to a number.
  • >
    Checks if the first value is greater than the second value after both values have been converted to numbers.
  • >=
    Checks if the first value is greater than or equal to the second value after both values have been converted to numbers.
  • <
    Checks if the first value is less than the second value after both values have been converted to numbers.
  • <=
    Checks if the first value is less than or equal to the second value after both values have been converted to numbers.
  • .*
    Checks if the first value starts with the text given in the second value.
  • *.
    Checks if the first value ends with the text given in the second value.
  • *.*
    Checks if the first value contains the text given in the second value.
  • REGEX
    Checks if the first value matches a regular expression set within the second value.
Output: STRING
Examples

IF('1','==S','1','Y','N')
outputs: 'Y'

IF('1','==S','1.0','Y','N')
outputs: 'N'

IF('1','==N','1.0','Y','N')
outputs: 'Y'

IF(CONCAT(Taxcode,'123'),'.*','GS','Y','N')
Taxcode = GST
outputs: 'Y'

IF(CONCAT('11',TaxRate),'>=','110',REPLACE('Y','Y','YY'),'N')
TaxRate = 0
outputs: 'YY'

IF(Description,'REGEX','(tax)','Y','N')
Description = 'goods and services tax applies'
outputs = 'Y'

INDEXOF(input_arg, matching_arg)

Description: Finds the position of first occurance of text matching within another string. Returns the starting position of the first match, or else -1.
Arguments

The function takes 2 arguments:
input_arg: the field name or literal text to read in and search on
matching_arg: the text to match on

Output: INTEGER
Examples

INDEXOF('example text','text');
returns: 8

INDEXOF('example text','something');
returns: -1

SUBSTRING('example text',INDEXOF('example text','text'))
returns: 'text'

SUBSTRING('example text','0',INDEXOF('example text','text'))
returns: 'example '

LENGTH(input_arg)

Description: Returns the number of characters that occur in the text data inputted.
Arguments

The function takes 1 argument:
input_arg: the field name or literal text to read in and obtain the length for

Output: INTEGER
Examples

LENGTH('example text');
returns: 12

LENGTH(productCode);
productCode = 'ABC123'
returns: 6

PAD(input_arg, max_length, padding_text, padding_direction)

Description: Adds text before or after given text to pad out the text to a specified length of characters. Length of the text and the text characters used to pad can be configured. For example the text "12345" can be padded with a 0 character to make it become "0000012345", for a 10 character length text.
Arguments

The function takes 4 arguments:
input_arg: The field name or literal text to read in and pad text with.
max_length: The number of characters that the text given must be padded to.
(optional)padding_text: The text characters to pad before (left) or after (right) of the text provided in the input arg. By default set to a space character. Note that if multiple characters are set in the argument then the sequence of text characters will appear each time a pad position needs to be set within the text being padded. See example below.
(optional)padding_direction: The position where the padding should be placed. Either set to LEFT (before input_arg text) or RIGHT (after input_arg text). Default value is LEFT.

Output: STRING
Examples

Example returns a text left padded with spaces up to 10 characters in total length

PAD('egtext','10')
returns: "    egtext"

Example returns a number left padded with zeros to 8 characters in total length

PAD('54321','8','0')
returns: "00054321"

Example returns a number text right padded with zeros to 9 characters in total length

PAD('54321','9','0','RIGHT')
returns: "543210000"

Example returns a text that has no padding since the text given is greater than the length that needs to be padded

PAD('egtext','4','0','LEFT')
returns: "egtext"

Example returns a text that has has been left padding with each of the 4 pad characters being placed with the text AB. Note the final text is longer than the 10 characters due to the pad text being multiple characters in length

PAD('egtext','10','AB','LEFT')
returns: "ABABABABegtext"

PAGE_NUMBER()

Description: Returns the current page number being processed when multiple pages of data are requested to be processed. This is relevant if an adaptor's data export has been configured to obtain data across multiple requests, based on a fixed number of records being able to be retrieved per request/page. This function will output the current page number of the records being processed, starting at page number 1.
Arguments

The function takes no arguments

Output: NUMBER
Examples

PAGE_NUMBER()
outputs: 1

If the 3rd page of data records is being requested, then the function would output the following:
PAGE_NUMBER()
outputs: 3

PARENT_ARRAY_INDEX(parent_count)

Description: Obtains the index/position of the current record being processed with its direct parent array, or parent array that it's an indirect descent of. If no index can be found then the function returns the value -1
Arguments

The function takes the 1 argument:
parent_count: Set the number of steps to navigate up the JSON tree from the position of the record being processed to find the record index of within the array. Set the value to 0 to get the index/position of the immediate array that a record exists within.

Output: NUMBER
Examples

Below is an example of JSON data obtained in entirety from a data source for a given data export.

{
    "sizes":
    [
        {
            "size":"small",
            "colours": ["green","red","blue"],
        },
        {
            "size":"medium",
            "colours": ["purple","red","orange"],
        },
        {
            "size":"large",
            "colours": ["purple","green","yellow"],
        }
    ]
}

If the JSON RecordSet path is set to sizes[*] then the following will be outputted:

PARENT_ARRAY_INDEX('0')
For Record 1, size: small
Outputs: 0

PARENT_ARRAY_INDEX('0')
For Record 2, size: medium
Outputs: 1

PARENT_ARRAY_INDEX('0')
For Record 3, size: large
Outputs: 2

If the JSON RecordSet Path is set to sizes[*].colours[*] the following would be output for across all records:
PARENT_ARRAY_INDEX('0')
Outputs: 0,1,2,0,1,2,0,1,2

If the JSON RecordSet Path is set to sizes[*].colours[*] the following would be output for across all records. This shows that for each colour record the function steps up to the parent "sizes" array to find the position of the size record that the colours array records are indirectly children of.

PARENT_ARRAY_INDEX('3')
Outputs: 0,0,0,1,1,1,2,2,2

If no parent array can be found at the level specified then the function will return -1. This can also be used to determine if a record is within an array.

PARENT_ARRAY_INDEX('2')
Outputs: -1,-1,-1,-1,-1,-1,-1,-1,-1

PARENT_NODE(input_arg, parent_count)

Description: Obtains the value at any parent node of a JSON record. This allows for traversal up a JSON tree.to find a value.
Arguments

The function takes the following 2 arguments:
input_arg: the field name or literal text to read in that contains the name of the JSON property to read from the parent node.
parent_count: Set literal text containing a number to denote how many levels of parents to traverse up to obtain the value with the given name. If the value is set to -1 then the function will traverse up the JSON tree until it finds an object with the name set in the input_arg

Output: STRING
Examples

Below is an example of JSON data obtained in entirety from a data source for a given data export.

{
    "customers"
    [
        {
            "keyCustomerAccountID":"4324324",
            "accountName":"Acme Industries",
            "addresses":
            [
                {
                    "description":"Primary Address",
                    "address1":"123 High Street",
                    "address2":"Melbourne",
                    "region":"Victoria"
                }
            ]
        }
    ],
    "country":"Australia"
}

If a data export is configured to get all address records from within any customer accounts. then a rule such as customers.[*].addresses[*] would return an array of address records.

If for each address record you wanted to get associated customer data then you would use the PARENT_NODE function like so:

PARENT_NODE('keyCustomerAccountID','3')

For the first address record this would output the value: 'Acme Industries'.
The number 3 denotes that from the address record it took 3 steps up the JSON hierarchy to get to the customer record.
Step 1: The array of address records
Step 2: The array of address records including its "addresses" key
Step 3: The customer account record

PARENT_NODE('keyCustomerAccountID','-1')
This function will too return the same value for the keyCustomerAccountID, since it will also traverse up the JSON tree until it finds an object with the name "keyCustomerAccountID"

If for a field in the address record you wanted to get the country at the top most level of the JSON structure, then you would use the following function:

PARENT_NODE('country','6')

This would output the value 'Australia' when being used within an address record field. The number 6 denotes that it took 6 steps to go from the address record up the JSON hierarchy to get the top JSON object containing the country property.
Step 1: The array of address records
Step 2: The array of address records including its "addresses" key
Step 3: The customer record
Step 4: The array of customer records
Step 5: The array of customer records including the "customers" key
Step 6: The top level JSON object

PARENT_NODE_NAME(parent_count)

Description: Obtains the key name of a parent node from a JSON record. This allows for traversal up a JSON tree.to find a key name associated to a parent.
Arguments

The function takes the 1 argument:
parent_count: Set literal text containing a number to denote how many levels of parents to traverse up to obtain the key name of the parent node.

Output: STRING
Examples

Below is an example of JSON data obtained in entirety from a data source for a given data export.

{
    "customers"
    [
        {
            "keyCustomerAccountID":"4324324",
            "accountName":"Acme Industries",
            "addresses":
            [
                {
                    "description":"Primary Address",
                    "address1":"123 High Street",
                    "address2":"Melbourne",
                    "region":"Victoria"
                }
            ]
        }
    ],
    "country":"Australia"
}

If a data export is configured to get all address records from within any customer accounts. then a rule such as customers.[*].addresses[*] would return an array of address records.

If for each address record you wanted to get the name of parent key that holds the array of customer records you would use the PARENT_NODE_NAME function like so:

PARENT_NODE_NAME('4')

For each of the address records this would output the value: 'customers'.
The number 4 denotes that from the address record it took 4 steps up the JSON hierarchy to get to the object storing the customers array, from which it then obtains its parent node name.
Step 1: The array of address records
Step 2: The array of address records including its "addresses" key
Step 3: The customer account record
Step 4: The customer account records

RAND(min_number_arg, max_number_arg, decimal_place_rounding_arg)

Description: Generates a random number, between a specified number range, to specified number of decimals. Without any arguments it generates a decimal number greater than equal to 0, and lower than or equal to 1, rounded to 10 decimal places.
Arguments

The function takes 3 arguments:
(optional) min_number_arg: Optional argument that specifies the the lowest number than can be generated. By default is set to 0.
(optional) max_number_arg: Optional argument that specifies the the highest number than can be generated. By default is set to 1.
(optional) decimal_place_rounding_arg: Optional argument that specifies how many decimal places the random number should be rounded to. By default set to 10.

Output: NUMBER
Examples

RAND()
Outputs a number between 1 and 0 rounded to 10 decimal places
eg. 0.4107640700

RAND('5','10')
Outputs a number between 5 and 10 rounded to 10 decimal places
eg. 7.7183348419

RAND('2','10000','0')
Outputs a number between 2 and 10000 rounded to 0 decimal places
eg. 5207

RAND('2','2000','2')
Outputs a number between 2 and 2000 rounded to 2 decimal places
eg. 1648.53

RECORD_SET_INDEX()

Description: Returns a number specifying the index/position of the Record Set that currently is having its records processed, based on the Record Set specified in the JSON RecordSet Path, For the 1st Record Set the function will return the number 0 onwards. This function is relevant if multiple Record Sets are specified in the path, with each separated by the --UNION-- clause.
Arguments

The function takes no arguments

Output: NUMBER
Examples

RECORD_SET_INDEX()
JSON RecordSet Path: dataRecords[*] --UNION-- dataRecords[*]
Outputs: 0 for the first time dataRecords[*] is processed
Outputs: 1 for the second time the dataRecords[*] is processed.

RECORD_SET_INDEX()
JSON RecordSet Path: dataRecords[*] --UNION-- records[*] --UNION-- dataRecords[*].prices[*]
Outputs: 0 for records found with dataRecords[*] path
Outputs: 1 for records found with records[*] path
Outputs: 2 for records found with dataRecords[*].prices[*] path

RECORD_INDEX(offset_amount)

Description: Returns a number specifying the index/position of the record being processed within the Record Set. This can be useful to found out the number of the record being processed.
Arguments

The function takes the 1 argument:
(optional) offset_amount: Set literal text containing a number that is added to the index number being returned. For example set the number 1 so that the 1st record returned by the function is the number 1 instead of 0.

Output: NUMBER
Examples

Below is an example of JSON data obtained in entirety from a data source for a given data export.

{
    "customers"
    [
        {
            "keyCustomerAccountID":"123",
            "accountName":"Acme Industries"
        },
        {
            "keyCustomerAccountID":"456",
            "accountName":"Chocolate Inc"
        },
        {
            "keyCustomerAccountID":"789",
            "accountName":"Round House Pty Ltd"
        }
    ]
}

If the JSON RecordSet path was set to customers[*] Then the function would return the following values for the found records:

RECORD_INDEX('0')
Record 1 keyCustomerAccountID: 123
Output: 0

RECORD_INDEX('1')
Record 1 keyCustomerAccountID: 123
Output: 1

RECORD_INDEX('0')
Record 1 keyCustomerAccountID: 456
Output: 1

RECORD_INDEX('0')
Record 1 keyCustomerAccountID: 789
Output: 2

REPLACE(input_arg, matching_arg, replace_arg, replace_method_arg)

Description: Replaces any matching text within a string value with another string, then outputs the final text
Arguments

The function takes 4 arguments:
input_arg: the field name or literal text to read in
matching_arg: the text to match on
replace_arg: the text to replace the matched text with.
replace_method_arg: (optional) the method to use to match the text on. Set to either LITERAL, or REGEX. If set to LITERAL then the function will match on the character sequence exactly set within the matching_arg argument. This is the default behaviour. If set to REGEX then the value set within the matching_arg needs to be a regular expression pattern in the .NET supported format. Using regular expression matching allows many different rules to be specified to determine which characters within the input text are matched on and replaced. Read more on .NET regular expressions.

Output: STRING
Examples

REPLACE(Taxcode,'GST','Other Value')
Taxcode = 'GST'
outputs: 'Other Value'

REPLACE('GST',TaxCode,'NOTAX')
Taxcode = 'GST'
outputs: NOTAX

REPLACE('GST',CONCAT('G','S','T'),CONCAT(Taxcode,'-123'))
Taxcode = 'Tax Free'
outputs = 'Tax Free-133'

REPLACE("This is example text",'te.t','test','REGEX')
outputs: "This is example test"

ROUND(input_arg, decimal_places_arg, rounding_method_arg)

Description: Converts the input string into a decimal number then rounds the number to the specified number of decimal places, using a specified rounding method.
Arguments

The function takes 3 arguments:
input_arg: (optional) the field name or literal text to read in and convert to a number
decimal_places_arg: (optional) the number of decimal placees to round the number by. By default it is set to 4.
rounding_method_arg: (optional) the method to round the number when the number is at a mid point. Set to either 'UP' or 'DOWN'. If set to UP (the default option) then a number such as 5.5 would be rounded up to 6. If set to DOWN then a number such as 5.5 would be rounded down to 5.

Output: NUMBER
Examples

ROUND()
outputs: 0.0000

ROUND('1234.34557')
outputs: 1234.3456

ROUND('1234.34557','2')
outputs: 1234.35

ROUND('1234.34557','2','DOWN')
outputs: 1234.34

SUBSTRING(input_arg, start_index_arg, end_index_arg)

Description: Reduces the length of the text given by cutting any text before the start character position given, and any text after the end character position if given.
Arguments

The function takes 3 arguments:
input_arg: the field name or literal text to read in and cut text from
start_index_arg: an integer number that specifies the position of the text in the input_arg to cut all text before it. If the number is less than 0 then it will be set to 0 (meaning no text will be cut).
(optional)end_index_arg: an integer number that specifies the position of the text in the input_arg to cut all text after it. If the number is greater than the length of the input_arg text value then it will be set to the length of the string (meaning no text at its end will be cut).

Output: STRING
Examples

To cut the first 5 characters of text you would set the function as so

SUBSTRING('example text','5');
returns: 'le text'

To cut the first 5 characters of text and the last 5 characters you would set the function to:

SUBSTRING('example text','5','7');
returns: 'le'

If the starting index is negative then no characters will be cut from the start of the string:

SUBSTRING('example text','-1','7');
returns: 'example'

If the end index is smaller than the start index then a blank value will be returned:

SUBSTRING('example text','5','2');
returns: ''

If the end index is larger than the length of the text then no text at the end will be cut:

SUBSTRING('example text','5','2000');
returns: 'le text'

TEXT_CASE(input_arg, text_case_arg)

Description: Changes the case of the given text value to either all upper case, all lower case, or title case.
Arguments

The function takes 2 arguments:
input_arg: the field name or literal text to read in
(optional)text_case_arg: either 'UPPER', 'LOWER', or 'TITLE'. Set to UPPER to change input text to all upper case letters. Set to LOWER to change the input text to allow lower case letters. Set to TITLE, to make the first letter in each of the words in the input text to upper case, and all other letters in the word lower case.

Output: STRING
Examples

Example returns text converted to all upper case.

TEXT_CASE('TEST data','UPPER')
returns: TEST DATA

Example returns text converted to all lower case.

TEXT_CASE('TEST Data','LOWER')
returns: test data

Example returns text converted to all lower case.

TEXT_CASE('TEST Data','TITLE')
returns: Test Data

TRIM(input_arg, trim_direction)

Description: Removes any white space surrounding text in a string, either on both sides of text or on the left or right side.
Arguments

The function takes 2 arguments:
input_arg: the field name or literal text to read in
(optional) trim_direction: the side on which to remove the white space. Set to either LEFT, RIGHT or BOTH. If this argument is not given then it will default to BOTH.

Output: STRING
Examples

TRIM(ProductDescription)
Product Description = '       4x4 Vehicle           '
outputs: '4x4 Vehicle'

TRIM('      GST         ','LEFT')
outputs: 'GST         '

TRIM('      GST         ','RIGHT')
outputs: '      GST'