Skip to Content
author's profile photo Former Member
Former Member

Zip Plus 4 - if then else statement

I'm working on a zip code issue. I am creating a form letter which will use xml code to populate the fields. I'm using Crystal Reports 2008 to design the letter. I need to enter a dash between the first four or five characters in the zip code field and the last four characters. Most of the zip codes do not have the "Plus 4" included so these fields will not need a dash. Some zip codes have 4 numbers before the u201CPlus 4u201D 1234-0000 and some will have 5 numbers before the u201CPlus 4u201D 12345-0000. I know nothing about writing code so this has been a real challenge for me.

I tried doing a search for this and couldn't find what I need.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 30, 2009 at 11:46 PM

    try this formula

    if len({ZipField})=8 then
    Picture({ZipField},"xxxx-xxxx")
    else
    Picture({ZipField},"xxxxx-xxxx")

    regards,

    Raghavendra.G

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.