-
Notifications
You must be signed in to change notification settings - Fork 16
Data Manipulation Functions
Julio Zevallos edited this page Jul 2, 2019
·
6 revisions
Below are the available functions one can enter to manipulate data. These functions can be used in overrides and exports for both service and UI steps, as well as UI inputs.
Note: All functions start with '(#' ,followed by function name, parameters seperated by '||', and finished with ')'.
- Example: (#randNum||8) or (#randDOB).
- Example: (#timeStamp||{{format}}) , where {{format}} is a variable with proper format for timestamp.
keyword | Parameters | Description |
---|---|---|
randNum | (digits) or (min,max) | Function that generates a random number. Takes 1 parameter as # of digits, or 2 parameters, specifying min and max |
timeStamp | (format) or (format,interval) or (format,start,end) | Function that generates a timestamp. Giving 1 parameter generates the current timestamp in given format. 2 parameters can generate a random timestamp when given the interval 'Y', 'M', 'W', 'D', specifying to generate a random timestamp in the current year, month, week, or day, respectively. When the interval contains a '+' or '-' , it will generate the current timestamp and modify it by the amount specified. If given '+2Y', it will generate the timestamp 2 years in the future, '-4W' generates the time 4 weeks in the past. Use 'Y' or 'y' for year, 'M' for month, 'W' or 'w' for week, 'd' for day, 'H' or 'h' for hour, 'm' for minute, 's' for second, and 'S' for millisecond. 3 parameters generates a random timestamp with given format, and between the start and end time. For examples of valid formats, visit https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html |
randAlphaNum | (length) or (format) | Function that generates a random alphanumeric value. Takes 1 parameter, a number that specifies the length of the value generated, or a format for the value. Example, format can be 'DDAALLUU', which will generate an 8 length value, where 'D' specifies number, 'L' specifies lower case leters, 'U' for upper case letters, and 'A' for any of the three. |
randName | no params or (nameType) | Function that generates a random name. No parameters generates a full name. 1 parameter takes in 'FIRSTNAME', 'LASTNAME', generating a first or last name, respectively. |
randDOB | no params or (age) or (format) or (min,max) or (format, age) or (format, min, max) | Generates a random date of birth. No params generates a random DOB for a person 0-100 years old, with default format: 'MM/dd/YYYY'. 1 Param of age generates a DOB of someone with specified age, with default format. 1 Param of format generates a DOB of someone age of 0-100, with given format. 2 params of min,max generates a random DOB of someone between the min-max age, with default format. 2 params of format,age generates a random DOB of someone with given age, and given format. 3 params generates a random DOB of someone between min-max age, and given format. |
There are also various math and string functions available. These can be executed with the keyword 'Math', or 'String', followed by the function name, and then the parameters.
- Example: (#Math||multiply||500||25) , or (#String||lowercase||mystring) .
keyword | Parameters | Description |
---|---|---|
add | (value1, value2) or (value1, value2, roundDigits) | This function returns the sum of two values, and if given 3 parameters, returns the sum, after being rounded the given amount of round digits, if possible. |
subtract | (value1, value2) or (value1, value2, roundDigits) | This function returns the subtraction of value 2 from value 1, and if given 3 parameters, returns the subtraction, after being rounded the given amount of round digits, if possible. |
multiply | (value1, value2) or (value1, value2, roundDigits) | This function returns the multiplication of value 1 and value 2, and if given 3 parameters, returns the multiplication, after being rounded the given amount of round digits, if possible. |
divide | (value1, value2) or (value1, value2, roundDigits) | This function returns the division of value 1 by value 2 and if given 3 parameters, returns the division, after being rounded the given amount of round digits, if possible. |
mod | (value1, value 2) | This function returns value1 mod value 2. |
roundUp | (value) | This function rounds the value up to the next whole number. |
roundDown | (value) | This function rounds the value down to the previous whole number . |
roundClosest | (value) | This function rounds the value to the closest neighbor digit. Example, if the value is 3.502, value returned will be 3.50. If value is 5.23948, value returned is 5.2395. |
keyword | Parameters | Description |
---|---|---|
lowerCase | (value) | This function returns the string in all lowercase letters. |
upperCase | (value) | This function returns the string in all uppercase letters. |
charAt | (value, index) | This function returns the character of the string at the index specified.(index starts at 0) |
contain | (value1, value2) | This function returns 'true' or 'false' , depending if value 1 contains value 2. |
compare | (value1, value2) | This function returns 'Equal' or 'Not Equal', depending if the two strings are equal or not. |
substring | (value1, indexstart, indexend) | This function returns the substring of the string, between the indexStart and the indexEnd. |