Skip to main content
1/7

text(): format an amount as money

Easy

Return the amount as money: a dollar sign, thousands separators and exactly two decimals. 1234.5 becomes "$1,234.50".

Zero must print as "$0.00", and a negative amount as "-$5.00".

Input

  • ri!amount: Decimal

ri! Rule Inputs

ri!amountDecimal
1234.5

Example 1: Thousands and a half

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

Example 2: Zero

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

Example 3: A million

Input: ri!amount
1000000
Expected output:
"$1,000,000.00"

Example 4: Extra decimals are cut off

Input: ri!amount
9.999
Expected output:
"$9.99"

Example 5: Negative

Input: ri!amount
-5
Expected output:
"-$5.00"

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