Reformatting Phone Numbers in Exports & Reports

Slate formats phone numbers based on each country's official formatting standards. For a USA phone number, that is +1 000-000-0000, and for a UK phone number (as an example), that might be +44 00 0000 0000 (spaces in specific segments, no hyphens). 

Because of this, if you are considering reformatting a phone number, you don't need to worry about trying to format them at the time of data capture. Reformatting a phone number is a data export and reporting consideration.

To apply different formatting in a query or report:

Add exports to a query library with a custom SQL format type or a formula type. Example formula:

(case when (@val like '+1 %') then stuff(stuff(@val, 4, 0, '('), 8, 1, ') ') else @val end)

This would take any USA phone number and format it from +1 203-404-4835 to +1 (203) 404-4835 and leave the international numbers untouched. 

If it's in a query library, you won't have to do this each time; the desired formatting with take place whenever you add that export. You can still store the phone number with the official formatting, and other systems that might need a phone number fed to them might require even a different format (such as E.164, which has no spaces or hyphens), so there's no one-size-fits-all type of formatting for these. 

Was this article helpful?
1 out of 2 found this helpful