Below is the calculation I created. Although the calculation shows as valid, the resulting field does not include the desired dash for 9-digit zip codes.
IF REGEXP_MATCH ([Zip],'[0-9]{5}')
THEN [Zip]
ELSEIF REGEXP_MATCH ([Zip],'[0-9]{9}')
THEN LEFT([Zip],5) + "-" + RIGHT([Zip],4)
END
7 respostas
So, looks like they are all either displayed as XXXXXXXXX or XXXXX. In that case, you can do this:
// Format the zip code
IF LEN([Zip])=5 THEN
[Zip]
ELSE
LEFT([Zip],5) + "-" + RIGHT([Zip], 4)
END