Skip to main content
5/7

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!digitsInteger
5551234

Example 1: Local number

Input: ri!digits
5551234
Expected output:
"555-1234"

Example 2: With an area code

Input: ri!digits
5551234567
Expected output:
"(555) 123-4567"

Example 3: The largest local number

Input: ri!digits
9999999
Expected output:
"999-9999"

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