Convert a value

Use the Convert a value action A tool for building the processes, logic, and direction within workflows. to change a value from one variable type to another variable type. The interchangeable variable types are Text, Boolean, DateTime, Decimal, and Integer. With this action you can extract numerical data from text strings, such as query results. This extraction is useful when you want to perform logical operations on the data, such as comparing the extracted value to a baseline value. The action supports a decimal value of up to 29 digits.

Important: When converting date value in a Text variable to a DateTime variable, you can use a Create a text string action to add the timezone offset. This is critical when timezone is minus (-01:00 to -11:00) and recommended best practice for all timezones.

For example, your users select a number option from a multiple choice field in a form. You want to use the selected number in a calculation later in the workflow; however, the selection from the multiple choice field is saved as a text variable type. Configure the Convert a value action to change the text value selected in the form (let's say, 100) to an integer value of 100, which you can use as part of a calculation later in the workflow.

In another example, employees submit budget requests using a form. You need to route budget requests for approval if the amount is greater than $10,000. You design a workflow to extract the requested budget amount. Because the amount is returned as text, you configure the Convert a value action to convert the text value to a numerical value. The workflow action assigns a task for approval if the numerical value is greater than the baseline value of $10,000 (10000). You also want to determine how long ago budget requests were submitted, so you configure the Convert a value action to convert the extracted submission date from text to a date/time format and then you use an Find interval between dates action to calculate the difference between the submission date and the current date.

Configure the Convert a value action

Note: You cannot convert integer and decimal values with scientific notations (for example, 7.7407E-6) using the Convert a value action.

  1. Add the action to the workflow and open the action configuration panel. For more information, see Add an action to the workflow.

  2. Type the Source value that is to be interpreted or select the variable that you want to change.
  3. Select a Target Type (Text, Boolean, DateTime, Decimal, Integer).

    Note: If the source value is text with a decimal and you are converting it to an integer, the decimal will be removed during conversion. For example, 99.88 will be converted to 99.

  4. If your Target Type is DateTime, type the Source dateTime format that the input string must match or select the variable for the format.
  5. (Optional) If you are converting text to an integer, select a Source locale to format the integer using regional settings.
  6. Select the Result output variable that stores the value with a new variable type.

Convert a value action fields and settings

Field

Description

Variable

Source value

The value to be interpreted and that changes variable type. If you are converting the source value to a date/time, then the source value must be a datetime string.

Text, Boolean, DateTime, Decimal, Integer

For recognized date and time formats, see the Microsoft article Custom Date and Time Format Strings.

Target Type The type of the output result variable into which you are converting the source value. Text, Boolean, DateTime, Decimal, Integer
Source dateTime format (Optional) Displayed when DateTime is selected for the Target Type. This format is the exact date and time format that the input string must match. When a format is selected, the input string is recognized only when it is an exact match to the selected format. For recognized date and time formats, see the Microsoft article Custom Date and Time Format Strings.
Source locale

(Optional) The region for conversion of the input string into another variable type. Used when converting text to an integer.

The following locales are available:

Austria (de-AT), Belgium (nl-BE), France (fr-FR), Germany (de-DE), Japan (ja-JP), Netherlands (nl-NL), Spain (es-E), Switzerland (de-CH), United Kingdom (en-GB), United States (en-US)

(n/a)

Result

The variable that stores the changed value with a new variable type. If the source value cannot be converted into a value that is compatible with the selected variable, the workflow will error.

Text, Boolean, DateTime, Decimal, Integer