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!amountDecimal1234.5
Example 1 — Thousands and a half
Input: ri!amount
1234.5
Output:
"$1,234.50"
Example 2 — Zero
Input: ri!amount
0
Output:
"$0.00"
Example 3 — A million
Input: ri!amount
1000000
Output:
"$1,000,000.00"
Example 4 — Extra decimals are cut off
Input: ri!amount
9.999
Output:
"$9.99"
Example 5 — Negative
Input: ri!amount
-5
Output:
"-$5.00"
Appian Expression Tips
- • Use
ri!variableNamefor 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