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/reporting consideration.

Suppose you want to apply different formatting in a query or report in that case:

Add exports to a query library that use 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—you'll get the desired formatting out whenever you add in that export. We'll 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 (e.g., 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?
0 out of 0 found this helpful