JSON XML CSV Data Field Functions
This document lists each of the JSON/XML?CSV field functions that are available to be used both within the JSON/XML/CSV Query Browser, as well as within the MYOB AccountRight and Generic adaptors when the Generic adaptor's data exports and imports are assigned to a JSON/XML/CSV Web Service/File data source type.
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: |
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: 3Record 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: 3Record 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: |
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: 36CALC(TaxRate,' + 33')
TaxRate = 10outputs: 43 CALC(CONCAT('10','00'),'/',Amount)
Amount = 50000outputs = 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: |
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: exampletext |
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: ABCD1FGHICONCAT(['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: |
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:
|
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:
|
Output: | STRING |
Examples |
ENCODE(exampleText,'XML')
exampleText = 'This is an "example" string /with data/ 'and' <other> text!'outputs: 'This is an "example" string /with data/ 'and' <other> 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:
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. |
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: |
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:
|
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 = GSToutputs: 'Y' IF(CONCAT('11',TaxRate),'>=','110',REPLACE('Y','Y','YY'),'N')
TaxRate = 0outputs: '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: |
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: |
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: |
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: 1If 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: |
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: smallOutputs: 0 PARENT_ARRAY_INDEX('0')
For Record 2, size: mediumOutputs: 1 PARENT_ARRAY_INDEX('0')
For Record 3, size: largeOutputs: 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: |
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. 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: |
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. 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: |
Output: | NUMBER |
Examples |
RAND()
Outputs a number between 1 and 0 rounded to 10 decimal placeseg. 0.4107640700 RAND('5','10')
Outputs a number between 5 and 10 rounded to 10 decimal placeseg. 7.7183348419 RAND('2','10000','0')
Outputs a number between 2 and 10000 rounded to 0 decimal placeseg. 5207 RAND('2','2000','2')
Outputs a number between 2 and 2000 rounded to 2 decimal placeseg. 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: |
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: 123Output: 0 RECORD_INDEX('1')
Record 1 keyCustomerAccountID: 123Output: 1 RECORD_INDEX('0')
Record 1 keyCustomerAccountID: 456Output: 1 RECORD_INDEX('0')
Record 1 keyCustomerAccountID: 789Output: 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: |
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: |
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: |
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: |
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: |
Output: | STRING |
Examples |
TRIM(ProductDescription)
Product Description = ' 4x4 Vehicle 'outputs: '4x4 Vehicle' TRIM(' GST ','LEFT')
outputs: 'GST 'TRIM(' GST ','RIGHT')
outputs: ' GST'
|