3/7

text(): round before you format

Medium

Return the score to one decimal place, rounded the ordinary way: 7.25 becomes "7.3" and 9.96 becomes "10.0".

text() on its own cuts extra decimals off rather than rounding them.

Input

  • ri!score — Decimal

ri! Rule Inputs

ri!scoreDecimal
7.25

Example 1 — Rounds up at a half

Input: ri!score
7.25
Output:
"7.3"

Example 2 — Rounds down

Input: ri!score
9.94
Output:
"9.9"

Example 3 — Rounds up into the next whole number

Input: ri!score
9.96
Output:
"10.0"

Example 4 — A whole number still shows a decimal

Input: ri!score
3
Output:
"3.0"

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