VALUE
Use the VALUE function to convert a text value that represents a number to a Number.
Use
VALUE( text )
Convert text to a number.
| Parameter | Required | Description |
|---|---|---|
| text | Yes | the text to convert |
| Returns | Number |
Examples
Converting Extracted Text for Calculations
You can use VALUE in a Variable Update formula to perform math on numbers that were originally part of a text string, such as a reference code.
- Scenario: A trigger provides a reference ID like "REF-100". You need to extract the "100" and add it to a running total variable called
$BatchTotal. - Formula:
VALUE(RIGHT(@Trigger.out.ReferenceID, 3)) + $BatchTotal. - Logic: The
RIGHTfunction extracts the last three characters ("100"), but returns them as the Text data type. The VALUE function then converts "100" (Text) into 100 (Number), allowing the plus (+) operator to successfully add it to the numeric variable. - Result: If
$BatchTotalwas 50, it would be updated to 150.
Validating Text-Based Inputs Against Numeric Constants
You can use VALUE in an Output Validation formula to ensure that data captured in a text field meets specific numeric limits defined by a Constant.
- Scenario: A user enters a price into a Text widget (perhaps to allow for flexible formatting), but you must validate that the entry does not exceed a fixed budget cap stored as a Constant named
#MaxSpend. - Formula:
ASSERT(VALUE(this) <= #MaxSpend, "The entry must be a number less than or equal to the budget limit."). - Logic: The keyword
thisrefers to the text entered by the user. VALUE converts that text into a number so the Comparison operator (<=) can check it against the numeric constant. - Result: If a user types "1200" and the
#MaxSpendis 1000, the formula returns FALSE, and the custom error message is displayed.