Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Testing for NULL Post Reply Post New Topic
Author Message
TokyoAnt
Newbie
Newbie


Joined: 16 Feb 2007
Online Status: Offline
Posts: 30
Quote TokyoAnt Replybullet Topic: Testing for NULL
    Posted: 29 Mar 2007 at 11:30pm
Hi,
 
I have a variable that may be NULL. How can I test this?
 
I tried ISNULL(myVariable)
 
but it said it was expecting a field. (A field is required here). What's the story with that!?Confused
 
Thanks for any help in advance
 
Ant
IP IP Logged
wrightr
Newbie
Newbie
Avatar

Joined: 30 Mar 2007
Location: United States
Online Status: Offline
Posts: 2
Quote wrightr Replybullet Posted: 31 Mar 2007 at 7:49pm
I'm a newbie, but I believe that the ISNULL() function is only for checking if a field contains a null.  
New user - Crystal Reports 9
IP IP Logged
TokyoAnt
Newbie
Newbie


Joined: 16 Feb 2007
Online Status: Offline
Posts: 30
Quote TokyoAnt Replybullet Posted: 31 Mar 2007 at 11:25pm
Thanks, I think you're correct which is why I'm asking the question.
 
Can you test for a null  valued variable in Crystal?
 
Many thanks for any answers on this
 
Ant
IP IP Logged
TokyoAnt
Newbie
Newbie


Joined: 16 Feb 2007
Online Status: Offline
Posts: 30
Quote TokyoAnt Replybullet Posted: 31 Mar 2007 at 11:40pm

In fact, there is a way to do this but it's really ugly.

When passing the value to the variable, check for null there, as this is a field from which the value is being pulled. Then if isnull(fieldValue) variable:= '1/1/1800' else variable := fieldValue.

Then it's a matter of checking the variable for this dummy date. If date is 1/1/1800, then it's actually null.  !Ugly neh!

Is there a 'correct' more elegant way this can be done in Crystal? Surely you can test a variable for null! Can't you? no?

Thanks for any help on this.

Ant

 

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.030 seconds.