Update on 7/9/2021

• storage_get, storage_set, json_loads, json_dumps functions are added.

Update on 6/1/2021

• to_date function is added.

Update on 5/26/2021

• urldecode function is added.

Update on 4/15/2021

• Date related functions (date_add, today, first_day_of_month, last_day_of_month) are added.

Now the Assign Value node supports general operation to be assigned as a value. This is a big improvement because you can use various types of functions as well as basic calculations.

To use this feature, create an Assign Value node and click 'Add Variable', select the target variable, then select 'Operation' as a type. Then you're all ready to type in operation.

As you see in the example above, you can use variables to be included in operation. And here are the calculations and the functions you can use in operation.

## Basic Calculations

• +, -, *, /, ( )
• % (modulus)
Example: 100%2 = 0, 100%8 = 4.
• ** (power)
Example: 100**2 = 10,000.

## Basic Functions

Any function works with function() format. For example, abs(-5).

• to_number: Converts the value to number format.
Example: to_number('4') = 4
• to_string: Converts the value to string format.
Example: to_string(7) = '7'
• to_boolean: Converts the value to boolean format.
Example: to_boolean(1) = True
• length: Returns the length of the value.
Example: length('abcde') = 5
• abs: Returns the absolute value of the value.
Example: abs(-5) = 5
• sin, cos, tan: Returns sin, cos, tan of the value.
Example: tan(90) = 1
• ceil, floor, round: Returns round up, round down, or round value.
Example: floor(2.1) = 2
• random, random_int: random() returns random number value between 0 and 1. random_int(min, max) returns a random whole number value between the min and the max values.
Example: random_int(-1, 2) = -1, 0, 1, or 2
• unix_timestamp:  Returns Unix timestamp value.
Example: unix_timestamp() = 1601672447

A lot of the advanced functions are used to manage JSON or String List type variables. Again, you can replace any value with a matching type of variable. Don't forget to use quotation marks when you use any string value in the function (for example, 'Allganize').

### dict

• Format: dict(key1, value1, key2, value2, ...)
• Create a JSON type variable's value structure using the key and value pairs. The function overwrites the values if the key exists.
• Variable type to assign the value: JSON
• Example: When @NAME variable has 'Allganize' as the value, dict('Name',@NAME,'Email','test@allganize.ai') = {'Name':'Allganize', 'Email':'test@allganize.ai'}

### dict_set

• Format: dict_set(@JSON_variable, key1, value1, key2, value2...)
• Add the keys and the values to the JSON variable. The function overwrites the values if the key exists.
• Variable type to assign the value: JSON
• Example: When @JSON_VAR has {'Name':'Allganize'} as the value, dict_set(@JSON_VAR,'Email','test@allganize.ai') = {'Name':'Allganize', 'Email':'test@allganize.ai'}

### dict_del

• Format: dict_del(@JSON_variable, key)
• Deletes the key from the JSON variable.
• Variable type to assign the value: JSON
• Example: When @JSON_VAR has {'Name':'Allganize', 'Email':'test@allganize.ai'} as the value, dict_del(@JSON_VAR,'Email') = {'Name':'Allganize'}

### dict_update

• Format: dict_update(JSON_variable_1, JSON_variable_2)
• Merge the two JSON variables. If there's the same key in both JSON variables, the latter one's value has priority.
• Variable type to assign the value: JSON
• Example: When @JSON_VAR has {'Name':'Allganize', 'Email':'test@allganize.ai'}, and @JSON_VAR2 has {'Name':'Alli', 'Type':'AnswerBot'}, dict_update(@JSON_VAR, @JSON_VAR2) = {'Name':'Alli', 'Email':'test@allganize.ai', 'Type':'AnswerBot'}

• Save the JSON form to the JSON variable.
• Variable type to assign the value: JSON
• Example: json_loads('{"Name":"Alli", "Email":"test@allganize.ai"}')

### json_dumps

• Format: json_dumps(@JSON_variable)
• Convert the JSON variable's value to string.
• Variable type to assign the value: String
• Example: json_dumps(@JSON_VAR)

### list

• Format: list(string1, string2, ...)
• Create a String List type variable with the strings.
• Variable type to assign the value: String List
• Example: list('Allganize', 'Test') = ['Allganize', 'Test']

### list_append

• Format: list_append(@string_list_variable, string1, string2, ...)
• Add the strings to the string variable.
• Variable type to assign the value: String List
• Example: When @STR_LIST has ['Allganize', 'Test'] as the variable value, list_append(@STR_LIST,"Alli") = ['Allganize', 'Test', 'Alli']

### list_reverse

• Format: list_reverse(@string_list_variable)
• Reverse the order of values in a string list variable.
• Variable type to assign the value: String List
• Example: When @STR_LIST has ['Allganize', 'Test'] as the variable value, list_reverse(@STR_LIST) = ['Test', 'Allganize']

### get_by_json_path

• Format: get_by_json_path(@JSON_variable, JSON_path)
• Returns the value in the JSON path from the JSON variable.
• Variable type to assign the value: String
• Example: When @JSON_VAR has {'Name':'Allganize', 'Email':'test@allganize.ai'} as the value, get_by_json_path(@JSON_VAR, '\$.Email') = 'test@allganize.ai'

### storage_set / storage_get

• Format: storage_set('key', @variable) / storage_get('key')
• storage_set saves the variable value to the key in the project level. The key can be any desired text. Saved value can be retrieved using storge_get. The variable to assign the value can be any type, as long as it's the same type with the saved variable.
• Variable type to assign the value: The same type with the saved variable
• Example: If a string variable's value is saved using storage_set('string' @string_variable), you can retrieve the value for any Skills or customers in the project using storage_get('string') and assign it to a string variable.

### contains

• Format: contains(@string_list_variable, string)
• Returns a boolean value after checking if the string list variable has the string value.
• Variable type to assign the value: Boolean, String
• Example: When @STR_LIST has ['Allganize', 'Test'] as the variable value, contains(@STR_LIST, 'Allganize') = 'True'

### append

• Format: append(@string_list_variable, string)
• Add the string value to the string list variable.
• Variable type to assign the value: String List
• Example: When @STR_LIST has ['Allganize', 'Test'] as the variable value, contains(@STR_LIST, 'Variable') = ['Allganize', 'Test', 'Variable']

### unique

• Format: unique(@string_list_variable)
• Remove duplicated values from the string list variable.
• Variable type to assign the value: String List
• Example: When @STR_LIST has ['Allganize', 'Test', 'Test'] as the variable value, unique(@STR_LIST) = ['Allganize', 'Test']

### urlencode

• Format: urlencode(@JSON_variable)
• Convert the JSON variable to a URL encoded form.
• Variable type to assign the value: String
• Example: When @JSON_VAR has {'key':'hello world!'} as the variable value, urlencode(@JSON_VAR) = 'key=hello+world%21'

### urldecode

• Format: urldecode(string)
• Convert the url-encoded string to JSON form.
• Variable type to assign the value: String or JSON
• Example: When @STR has 'key=hello+world%21' as the variable value, urldecode(@STR) = {'key':'hello world!'}

### regex_sub, regex_isub

• Format: regex_sub(regex_pattern, string1, string2) or regex_isub(regex_pattern, string1, string2)
• Replace regex pattern in the string 2 with string 1. regex_sub is case sensitive, regex_isub is not.
• Variable type to assign the value: String
• Example: When @STR has 'ooAoO' as the variable value, regex_isub(r'o{2}', 'A', @STR) = 'AAA'

### date_format

• Format: date_format(regex_date_format, date)
• Convert the date to the regex date format.
• Variable type to assign the value: String
• Example: When @DATE (Date or String variable) has '2020-01-11' as the variable value, date_format(r'%Y-%m', @DATE) = '2020-01'

### to_date

• Format: to_date(date_format, YMD_form(optional))
• Convert the date format to a date variable format. Date format can be any of theses: YYYYMMDD, YYYY/MM/DD, YYYY-MM-DD, YYYY MM DD, YYYY M D YYYY-M-D, YYYY/M/D, YYMMDD, YY/M/D, YY-M-DD, YY M DD
• You can put MDY for the optional YMD form to change the order of year / month / day in the input date format. For example, you can use MMDDYY, MM/DD/YYYY, etc. Please see Example 2 below.
• The input date form cannot start with 0.
• Variable type to assign the value: String or Date.
• Example 1 : When @DATE (String or Number variable) has '20210602' as the variable value, to_date(@DATE) = '2021-06-02'.
• Example 2 : When @DATE (String or Number variable) has '060221' as the variable value, to_date(@DATE, "MDY") = '2021-06-02'.

• Format: date_add(date, number)
• Add the number of days to the date.
• Variable type to assign the value: Date
• Example: When @DATE (Date or String variable) has '2020-01-11' as the variable value, date_add(@DATE, 2) = '2020-01-13'

### today

• Format: today()
• Variable type to assign the value: Date or String
• Example: If today's date is April 15th, 2021, today() = '2021-04-15'

### first_day_of_month

• Format: first_day_of_month()
• Return the first day of the current month.
• Variable type to assign the value: Date or String
• Example: If today's date is April 15th, 2021, first_day_of_month() = '2021-04-01'

### last_day_of_month

• Format: last_day_of_month()
• Return the last day of the current month.
• Variable type to assign the value: Date or String
• Example: If today's date is April 15th, 2021, last_day_of_month() = '2021-04-30'

### find_all, find_iall

• Format: find_all(regex_pattern, string) or find_iall(regex_pattern, string)
• Find and return the first matching result with the regex pattern from the string. find_all is case sensitive, find_iall is not.
• Variable type to assign the value: String
• Example: When @STR has 'Type of the OS: Windows' as the variable value, find_iall(r'(windows|mac|linux)', @STR) = 'Windows'

### substr

• Format: substr(string, number)
• Return the first [number] characters from the string.
• Variable type to assign the value: String
• Example: When @STR has '3months' as the variable value, substr(@STR, 2) = '3m'