Skip to main content
4/7

text(): show negatives in brackets

Medium

Return the amount with thousands separators and two decimals, showing a negative amount in brackets instead of with a minus: -1234.5 becomes "(1,234.50)".

Zero is shown like a positive amount.

Input

  • ri!amount: Decimal

ri! Rule Inputs

ri!amountDecimal
-1234.5

Example 1: Positive

Input: ri!amount
1234.5
Expected output:
"1,234.50"

Example 2: Negative

Input: ri!amount
-1234.5
Expected output:
"(1,234.50)"

Example 3: Zero looks positive

Input: ri!amount
0
Expected output:
"0.00"

Example 4: A small negative

Input: ri!amount
-0.5
Expected output:
"(0.50)"

Appian Expression Tips

  • • Use ri!variableName for rule inputs
  • • Use a!localVariables(local!x: …, body) for locals
  • • Use a!forEach(items: …, expression: fv!item) to iterate
  • • Use where() / reject(fn!isnull, list) to filter