text(): format a phone number
Medium
Numbers of up to 7 digits are local and should look like "555-1234". Longer numbers include the area code and should look like "(555) 123-4567".
A condition in square brackets at the start of a section chooses that section by value.
Input
ri!digits— Integer
ri! Rule Inputs
ri!digitsInteger5551234
Example 1 — Local number
Input: ri!digits
5551234
Output:
"555-1234"
Example 2 — With an area code
Input: ri!digits
5551234567
Output:
"(555) 123-4567"
Example 3 — The largest local number
Input: ri!digits
9999999
Output:
"999-9999"
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