Report Design
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Report Design
Message Icon Topic: Checking for NULL date Post Reply Post New Topic
Author Message
emoreau
Newbie
Newbie
Avatar

Joined: 13 Nov 2006
Location: Canada
Online Status: Offline
Posts: 8
Quote emoreau Replybullet Topic: Checking for NULL date
    Posted: 29 Dec 2006 at 8:55am
I have a formula (crystal syntax) in a report. In this formula, I have to check the mont of a date field but this date sometime contains a NULL value.
 
If I remove the comment from the line containing "month({UnitValueCurrent.Date})", I receive an error saying that a date value must be provided.
 
Any ideas on how I can handle this?
 
My current formula:
if (not {?ShowSRUnitValues}) then //or IsNull({UnitValueCurrent.Date}) then
    0
else
    if {@ReturnCDN} > 0 then
        {UnitValueCurrent.ClassA} * ( 1 + ( {@ReturnCDN} / 100 * .8) )
    else
//        if not ( month({UnitValueCurrent.Date}) = 12 ) then
//            {UnitValueCurrent.ClassA}
//        else
            {UnitValueCurrent.ClassA} * ( 1 - ( {@ReturnCDN} / 100 * .8) )
HTH

Eric Moreau
MCSD, Visual Developer - Visual Basic MVP
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 02 Jan 2007 at 9:22am
You could break down your If statement further to something like this:
if (not {?ShowSRUnitValues}) then 
    0
else if IsNull({UnitValueCurrent.Date}) then
    0
else
    if {@ReturnCDN} > 0 then
        {UnitValueCurrent.ClassA} * ( 1 + ( {@ReturnCDN} / 100 * .8) )
    else
        if not ( month({UnitValueCurrent.Date}) = 12 ) then
            {UnitValueCurrent.ClassA}
        else
            {UnitValueCurrent.ClassA} * ( 1 - ( {@ReturnCDN} / 100 * .8) )
 
I've found that sometimes Crystal gets confused with 'or' in the condition.  Sometimes you can resolve the problem by switching the order of what's being evaluated in the or statement and sometimes you just have to find a different way to handle it.
 
-Dell
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.047 seconds.