Report Design
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Report Design
Message Icon Topic: Multiple if's Post Reply Post New Topic
Author Message
crystalgal
Groupie
Groupie
Avatar

Joined: 20 Feb 2009
Location: United States
Online Status: Offline
Posts: 66
Quote crystalgal Replybullet Topic: Multiple if's
    Posted: 20 Feb 2009 at 8:00am

We have 3 columns of email addresses(student, home and work) in the report I need

case 1-sometimes column 1 or 2 might be empty, then I  need 3rd email.
case 2- sometimes column 1 or 3 might be empty then I nedd 2nd email.
case 3-sometimes 1,2 or 1,3 or 2,3 columns are empty then I need the available one
case 4--- if all 3 columns have data , then I need all email adresses.
 
Can anyone help? I tried using isnull but I do not get if 2 columns are empty.
 
Please help, thanks
 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 20 Feb 2009 at 8:59am
How are you displaying the addresses?  One long string or multiple entries? 
If one long string, in the report you could have a shared variable and you can add to the shared variable with ISNULL for each column in question.
Hope this helps.
IP IP Logged
crystalgal
Groupie
Groupie
Avatar

Joined: 20 Feb 2009
Location: United States
Online Status: Offline
Posts: 66
Quote crystalgal Replybullet Posted: 20 Feb 2009 at 9:34am
database has three different columns and I need all in one column separated with a comma. I used the isnull but am not getting the email address if there are 2 empty fields.
Thanks
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 23 Feb 2009 at 6:12am
no prob.  variables to the rescue...
could use something like:
local stringvar emails := "";
 
if not isnull({table.email1}) then emails := emails + {table.email1};
if not isnull({table.email2}) then
  if emails = "" then
    emails := emails + {table.email2}
  else
    emails := emails + ", " + {table.email2};
if not isnull({table.email3}) then
  if emails = "" then
    emails := emails + {table.email3}
  else
    emails := emails + ", " + {table.email3};
 
emails
 
hope this helps
 
IP IP Logged
crystalgal
Groupie
Groupie
Avatar

Joined: 20 Feb 2009
Location: United States
Online Status: Offline
Posts: 66
Quote crystalgal Replybullet Posted: 24 Feb 2009 at 6:37am

Thank you very much lockwelle.

Big%20smile
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.