Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Not(isnull{mydate}) Conditional Formatting Post Reply Post New Topic
Author Message
WhyNot
Newbie
Newbie


Joined: 24 Jan 2012
Online Status: Offline
Posts: 2
Quote WhyNot Replybullet Topic: Not(isnull{mydate}) Conditional Formatting
    Posted: 24 Jan 2012 at 6:13am
My report has 3 date fields, each of which may be populated from a MYSQL DB, and 3 corresponding text boxes on the report, one for each field. My goal is to use conditional formatting to suppress 2 of the 3 text boxes.
I thought i was on the right track on the first text box with: (isnull({tbl_cmnform.RevisedDate})) and (isnull({tbl_cmnform.RecertificationDate})) in the suppress formula,
However, text boxes 2 and 3 do not suppress, and they should as they have no date value.
textBox2 suppress:NOT(isnull({tbl_cmnform.RevisedDate})) and (isnull({tbl_cmnform.RecertificationDate}))

textbox3 suppress: isnull({tbl_cmnform.RecertificationDate}))

seems as though CR does not see the blank date as null?

I'm pretty new to CR, I have some basic SQL skills, not much.
In a perfect world I would make some kind of If Then statement for the suppress that also varied the text instead of having three text boxes.
If (isnull({tbl_cmnform.RevisedDate})) and (isnull({tbl_cmnform.RecertificationDate}))
then "Initial"
else if NOT(isnull({tbl_cmnform.RevisedDate})) and (isnull({tbl_cmnform.RecertificationDate})) then "Revised"
else if (isnull({tbl_cmnform.RecertificationDate})) then "Recertified" end if

Probably should get the syntax correct before I attempt the grander things
IP IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet Posted: 24 Jan 2012 at 12:15pm
maybe try
(isnull({tbl_cmnform.RevisedDate})or {tbl_cmnform.RevisedDate}="" ) and (isnull({tbl_cmnform.RecertificationDate}) or {tbl_cmnform.RecertificationDate} ="")

as for crystal syntax
it seems fine axept take out "end if"

If (isnull({tbl_cmnform.RevisedDate})) and (isnull({tbl_cmnform.RecertificationDate}))
then "Initial"
else if NOT(isnull({tbl_cmnform.RevisedDate})) and (isnull({tbl_cmnform.RecertificationDate})) then "Revised"
else if (isnull({tbl_cmnform.RecertificationDate})) then "Recertified" 


Edited by kostya1122 - 24 Jan 2012 at 12:16pm
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 25 Jan 2012 at 7:13am
CR can be odd.
if isnull({table.field}) is not returning true, then I would just display {table.field}. 
 
If it has a value in it like '1/1/1900' then you will to look for that. If it is blank, and not null, I would expect that the field is coming back as string and not as Date.
 
It is not the default, but if you have checked the option (on Report Options) to convert NULLs to default values, that would also be something that would be causing the formula to not behave as expect
 
HTH
IP IP Logged
WhyNot
Newbie
Newbie


Joined: 24 Jan 2012
Online Status: Offline
Posts: 2
Quote WhyNot Replybullet Posted: 25 Jan 2012 at 8:48am
Thank you for the response. I get an error like 'expecting a date there', I also tried your formula with
(isnull({tbl_cmnform.RevisedDate})or {tbl_cmnform.RevisedDate}=datetime(0,0,0,0,0,0)) and (isnull({tbl_cmnform.RecertificationDate}) or {tbl_cmnform.RecertificationDate} =datetime(0,0,0,0,0,0))

No date time error, but not working correctly. As near as I can figure as I travel the internet, my problem has to do with the null value there, and my solution seems to be to think of a different way to accomplish my goals.

If I do come up with a solution, I will post it.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 25 Jan 2012 at 9:19am

IMHO, I would test each of your 3 values with 3 isnull formula fields to see if each of those are working as you expected. If they are not it would give you a clue as to where an issue is.

isnull({tbl_cmnform.RevisedDate})
 
isnull({tbl_cmnform.RecertificationDate})

isnull(other date field)
 
Place each next to your dates on each row and see if you get TRUE when the value is empty and and FALSE when the value has any date.
 
Depending on your report set up, Crystal can treat NULLs a little differently than you might expect but there is usually a pretty straight forward solution.


Edited by DBlank - 25 Jan 2012 at 9:20am
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.012 seconds.