Conversion
(Available from version 7.0 onwards.)
Use the functions in the Conversion built-in service to convert data from one data type to another. Separate functions are provided for each supported source-target conversion pair.
Conversion functions are often required to convert data to a format that can be used by another function.
The Concatenate function in the Text built-in service is used to join text strings to form a sentence. If you want to include a decimal value in that sentence, that decimal value must be converted to a text string.
The workflow below concatenates text to form a message such as "Dear John, your current balance is 100." Because the property Customer.Balance is of type decimal, it must be converted to text using the function Convert Decimal to Text.
Functions
Converts a Boolean value to a decimal value.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
value |
Boolean (True/False) |
The value to convert |
Returns
Returns a decimal value of 1 for True and 0 for False.
Example
This workflow converts the Boolean value True to a decimal value and stores the decimal value in the variable Decimal_Var.
When run, Decimal_Var is set to 1.
Converts a Boolean value to a number value.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
value |
Boolean (True/False) |
The value to convert |
Returns
Returns a number value of 1 for True and 0 for False.
Example
This workflow converts the Boolean value False to a number value and stores the number value in the number variable Number_Var.
When run, Number_Var is set to 0.
Converts a Boolean value to a text string.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
value |
Boolean (True/False) |
The value to convert |
Returns
Returns the text True or False.
Example
This workflow converts the Boolean value True to a text string and stores the text string in the text variable Text_Var.
When run, Text_Var is set to True.
Returns a text string containing only the date component of a DateTime value.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
value |
DateTime |
The DateTime value to convert to text. The time component is ignored. |
Returns
Returns a text string containing only the date of the DateTime value in the format mm/dd/yyyy, for example, 10/19/2020.
Example
This workflow writes the date of the DateTime value 19/10/2020 00:45 to the text variable Text_Var.
When run, Text_Var is set to 10/19/2020.
Converts a DateTime value to a text string.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
value |
DateTime |
The DateTime value to convert to text |
Returns
Returns a text string of the specified date and time in the format mm/dd/yyyy hh:mm AM/PM, for example 10/19/2020 12:45:00 AM.
Example
This workflow converts the DateTime value 19/10/2020 00:45 to a text string and stores the text string in the variable Text_Var.
When run, Text_Var is set to 10/19/2020 12:45:00 AM.
Converts a decimal value to a Boolean value. If the decimal value is 0, a Boolean value of False is returned. Otherwise, a Boolean value of True is returned.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
value |
Decimal |
The value to convert |
Returns
Returns a Boolean value of False for a decimal value of 0, otherwise returns True.
Example
This workflow converts the decimal value of 1 to a Boolean value and stores it in the Boolean variable Boolean_Var.
When run, Boolean_Var is set to True.
Converts a decimal value to a text string in the local currency format.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
value |
Decimal |
The value to convert |
Returns
Returns a text string containing the value of the decimal in the local currency format.
Example
This workflow stores the value 184.32 in the text variable Text_Var in the local currency format.
When run, Text_Var is set to $184.3200.
Converts a decimal value to a number value (integer) by removing all values after the decimal point.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
value |
Decimal |
The value to convert |
Returns
Returns a number value obtained by removing all values after the decimal point from the decimal value.
Example
This workflow converts the decimal value of 4.8 to a number and stores the number in the number variable Number_Var.
When run, Number_Var is set to 4.
Converts a decimal value to a text string.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
value |
Decimal |
The value to convert |
Returns
Returns a text string.
Example
This workflow converts the decimal -54.321 to a text string and stores it in the text variable Text_Var.
When run, Text_Var is set to -54.321.
Converts a decimal value to a DateTime value, where the DateTime value is calculated as 01/01/1900 00:00 plus the number of seconds represented by the decimal value.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
value |
Decimal |
The number of seconds to add to the DateTime value 01/01/1900 00:00 |
Returns
Returns a DateTime value.
Example
This workflow adds 7500 seconds to the DateTime value 01/01/1900 00:00 and stores the result in the DateTime variable DateTime_Var.
When run, DateTime_Var is set to 1900-01-01 02:05:00. 7500 seconds is equivalent to 125 minutes or 2 hours and 5 minutes. When 2 hours and 5 minutes is added to 01/01/1900 00:00, the result is 1900-01-01 02:05:00.
Converts a hexadecimal number (in text format) to a number value. Negative numbers are converted using Hex signed 2's complement.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
value |
Text |
The hexadecimal number to convert. Do not include the 0x prefix to the hexadecimal number. |
Returns
Returns a number value. If the text value provided is not a legal hexadecimal number, then a number value of 0 is returned.
Example
This workflow converts the hexadecimal number 1D4C to a number and stores it in the number variable Number_Var.
When run, Number_Var is set to 7500, the number equivalent of the hexadeciml 1D4C.
Converts a number value to a Boolean value. If the number value is 0, a Boolean value of False is returned. Otherwise, a Boolean value of True is returned.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
value |
Number |
The value to convert |
Returns
Returns a Boolean value of False for a number value of 0, otherwise returns True.
Example
This workflow converts the number value of 130 to a Boolean value and stores it in the Boolean variable Boolean_Var.
When run, Boolean_Var is set to True.
Converts a number value to a text string in the local currency format.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
value |
Number |
The value to convert |
Returns
Returns a text string containing the value of the number in the local currency format.
Example
This workflow stores the value 183 in the text variable Text_Var in the local currency format.
When run, Text_Var is set to $183.
Converts a number value to a decimal value.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
number |
Number |
The number to convert |
Returns
Returns a decimal value.
Example
This workflow converts the number -132 to a decimal value and stores it in the decimal variable Decimal_Var.
When run, Decimal_Var is set to -132.
Converts a number to a hexadecimal value in text format. Negative numbers are converted using Hex signed 2's complement.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
value |
Number |
The number to convert to hexadecimal. |
Returns
Returns a text string containing a hexadecimal value.
Example - Positive Number
This workflow converts the number 7500 to a hexadecimal value and stores it in the text variable Text_Var.
When run, Text_Var is set to 1D4C, the hexadecimal equivalent of 7500.
Example - Negative Number
This workflow converts the number -7500 to a hexadecimal value and stores it in the text variable Text_Var.
When run, Text_Var is set to FFFFE2B4, the hexadecimal equivalent of -7500 when using Hex signed 2's complement.
Converts a number value to a text string.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
value |
Number |
The value to convert |
Returns
Returns a text string.
Example
This workflow converts the number -54 to a text string and stores it in the text variable Text_Var.
When run, Text_Var is set to -54.
Converts a number value to a DateTime value, where the DateTime value is calculated as 01/01/1900 00:00 plus the number of seconds represented by the number value.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
value |
Number |
The number of seconds to add to the DateTime value 01/01/1900 00:00 |
Returns
Returns a DateTime value.
Example
This workflow adds 7500 seconds to the DateTime value 01/01/1900 00:00 and stores the result in the DateTime variable DateTime_Var.
When run, DateTime_Var is set to 1900-01-01 02:05:00. 7500 seconds is equivalent to 125 minutes or 2 hours and 5 minutes. When 2 hours and 5 minutes is added to 01/01/1900 00:00, the result is 1900-01-01 02:05:00.
Converts a text string to a Boolean value. If the text specified is False (not case-sensitive), returns a Boolean value of False. Otherwise returns a Boolean value of True.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
text |
Text |
The text string to convert |
Returns
Returns a Boolean value of False if the text specified is False (not case-sensitive). Otherwise returns a Boolean value of True.
Example
This workflow converts the text string false to a Boolean value and stores it in the Boolean variable Boolean_Var.
When run, Boolean_Var is set to False.
Converts a text string to a DateTime value.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
text |
Text |
The text to convert to DateTime. The text must be specified in the format mm/dd/yyyy hh:mm:ss, or yyyy-mm-dd hh:mm:ss. You can specify the hours in:
|
Returns
Returns a DateTime value.
Example
This workflow converts the text 11/24/2020 10:35:10 AM to a DateTime value and stores it in the DateTime variable DateTime_Var.
When run, DateTime_Var is set to 2020-11-24 10:35:10.
Converts a text string to a decimal value.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
text |
Text |
A text string that represents a decimal value |
Returns
Returns a decimal value. If the text string specified does not represent a decimal value, a decimal value of 0 is returned.
Example
This workflow converts the text string 3.14159 to a decimal and stores it in the decimal variable Decimal_Var.
When run, Decimal_Var is set to 3.14159.
Converts a text string to a number value.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
text |
Text |
The text string to convert |
Returns
Returns a number value (integer) . If the text string specified does not represent a number value, a number value of 0 is returned. If the text string includes a decimal value, such as 3.14159, a number value of 0 is returned.
Example
This workflow converts the text string 42 to a number and stores it in the number variable Number_Var.
When run, Number_Var is set to 42.
Converts the time component of a DateTime value to a decimal value equivalent to the number of seconds since the start of the day.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
value |
DateTime |
The DateTime to convert. The date portion is ignored. |
Returns
Returns the time component of the DateTime value as a decimal value equivalent to the number of seconds since the start of the day. For example, the time component of 2020-09-07 01:00:00 is 1 hour, or 3600 seconds, from the beginning of the day. The DateTime value will convert to a decimal value of 3600.
Example
This workflow converts the time component of the DateTime value of 08/09/2020 01:00 to a decimal value and stores it in the decimal variable Decimal_Var.
When run, Decimal_Var is set to 3600, as 3600 seconds is equivalent to the time component of 01:00.
Converts the time component of a DateTime value to a number value equivalent to the number of seconds since the start of the day.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
value |
DateTime |
The DateTime value to convert. The date portion is ignored. |
Returns
Returns the time component of the DateTime value as a number value equivalent to the number of seconds since the start of the day. For example, the time component of 2020-09-07 01:00:00 is 1 hour, or 3600 seconds, from the beginning of the day. The DateTime value will convert to a number value of 3600.
Example
This workflow converts the time component of the DateTime value of 08/09/2020 01:00 to a number value and stores it in the number variable Number_Var.
When run, Number_Var is set to 3600, as 3600 seconds is equivalent to the time component of 01:00.
Converts the time component of a DateTime value to a text string.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
value |
DateTime |
The DateTime value to convert. The date portion is ignored. |
Returns
Returns the time component of the DateTime value as a text string.
Example
This workflow converts the time component of the DateTime value of 2020-09-07 00:01:00 to a text string and stores it in the text variable Text_Var.
When run, Text_Var is set to 12:01:00 AM.