Writing Code
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Writing Code
Message Icon Topic: Crystal Report Formula Field Problem Post Reply Post New Topic
Author Message
ranigoal
Newbie
Newbie


Joined: 11 Sep 2007
Location: United States
Online Status: Offline
Posts: 12
Quote ranigoal Replybullet Topic: Crystal Report Formula Field Problem
    Posted: 12 Sep 2007 at 5:57am

I am new to this.

Here is my problem I have columns for city, state, zip code. The problem with that was I could not formatted nicely for example:

Raleigh             , NC 566777

 

Spring Field     , OR 5552222

 

As you can see there are a lot of empty spaces. So I created a Formula field to make it look nice

Example:

Formula1field1: this is the code behind

{command.Mailing City} + ", " + {command.Mailing State/Province} + " " + {command.Mailing Zip/Postal Code};

 

This worked fine but the problem was if I have an empty zip code which is possible it won’t display the city or state. In some other cases I might have the city and the zip code not the state.

 

So for simplicity I changed the code behind the formula field to the following:

 

if ((Not IsNull({command.Mailing City}))and (Not IsNull({command.Mailing State/Province})) and  (IsNull({command.Mailing Zip/Postal Code}))) Then

  addre := {command.Mailing City} + ", " + {command.Mailing State/Province};

 

If ((Not IsNull({command.Mailing City}))and (Not IsNull({command.Mailing State/Province})) and  (Not IsNull({command.Mailing Zip/Postal Code}))) Then

    addre := {command.Mailing City} + ", " + {command.Mailing State/Province} + " " + {command.Mailing Zip/Postal Code};

 

the problem with this it is always executing the last if Statement

 

 

can you help me plz

IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.