BlurredVision
Technical User
Hello all - I am creating a report to be exported to a text file and I need to create a formula to add zero's to a zip code field if the length of the field is not equal to 9.
I am using crystal reports v10 and here is what I have so far:
stringvar zipcode := replace({RV_Practitioner_Offices_V.Zip_Code},"-","");
if len(trimleft(zipcode)) = 9 then
zipcode else
if len(trimleft(zipcode)) = 5 then
zipcode + "0000" else
if len(trimleft(zipcode)) = 0 then
"000000000"
My question is, my formula is somewhat cumbersome in dealing with every possible circumstance, and does anyone have a better example on how to handle this?
Here is a example on how the database might appear:
60714-4568
60714
607-
6071
Thanks..
I am using crystal reports v10 and here is what I have so far:
stringvar zipcode := replace({RV_Practitioner_Offices_V.Zip_Code},"-","");
if len(trimleft(zipcode)) = 9 then
zipcode else
if len(trimleft(zipcode)) = 5 then
zipcode + "0000" else
if len(trimleft(zipcode)) = 0 then
"000000000"
My question is, my formula is somewhat cumbersome in dealing with every possible circumstance, and does anyone have a better example on how to handle this?
Here is a example on how the database might appear:
60714-4568
60714
607-
6071
Thanks..