formatting phone number when passed as string

I am trying to format the phone number passed to the report

variable is passed as a string

in the pattern box i have

TELEPHONE pattern: <textField pattern="(###)###-####" isBlankWhenNull="true">

However this DOES NOT change the format of the field - the numbrs print out 12345614789 as opposed to (123)456-4789

Any ideas on how to alter this outcome

Portlight's picture
1472
Joined: Jan 6 2011 - 9:11am
Last seen: 8 years 9 months ago

1 Answer:

(phone != null && phone.length() == 10) ? "(" + phone.substring(0,3) + ")" + phone.substring(3,6) + "-" + phone.substring(6,10) : phone

in text expression field
Portlight's picture
1472
Joined: Jan 6 2011 - 9:11am
Last seen: 8 years 9 months ago
Feedback