Skip to main content

ABS

Returns the absolute value of a number. The absolute value of a number is the number without its sign.

Use

ABS( number )
Returns the absolute value of a number.

ParameterRequiredDescription
numberYesthe number to return the absolute value of

ReturnsNumber

Examples

Validation Logic for Budget Variance

In a scenario where a user enters a "Budget Deviation" amount on a form, you may want to ensure that the total deviation—whether over or under the budget—does not exceed a certain limit (e.g., $100). You can apply this as an Output Validation Formula.

  • Formula: ABS(this) <= 100
  • Logic:
    • this: Refers to the numerical value the user entered in the field.
    • ABS(this): Converts the entry to its absolute value. For instance, if the user enters -120 (indicating they are $120 under budget), ABS returns 120.
    • Comparison: The formula then checks if 120 is less than or equal to 100. Since it is not, the formula returns FALSE, and the entry is marked as invalid.

Calculating Magnitude in Variable Updates

You can use ABS within a Variable Update formula to calculate the total change between two numerical points, ensuring the result is always a positive number even if the values were subtracted in an order that produces a negative result.

  • Formula: ABS(@Trigger.out.StartingMileage - @Trigger.out.EndingMileage)
  • Logic:
    • @Trigger.out: These are data items captured when the approval started.
    • Subtraction: If the starting mileage is 15,000 and the ending mileage is 14,500 (due to a calculation or entry error), the result of the subtraction is 500.
    • ABS(...): Applying ABS ensures that even if the result was -500, the variable $TotalDistance would be updated to 500. This ensures your Flow data remains accurate for reporting or subsequent logic steps.