Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Replacing missing field Post Reply Post New Topic
Author Message
NedSchneebly
Newbie
Newbie


Joined: 09 Jul 2009
Location: Canada
Online Status: Offline
Posts: 23
Quote NedSchneebly Replybullet Topic: Replacing missing field
     Posted: 14 Jul 2009 at 2:57pm

Hi all - I am running CR XI.

I am trying to replace nothingness with something. In our TrackIt database, some users do not select anything from the pulldown menues, and that is not totally clear when creating a report (especially if I am creating groups based on what was selected). I would like to replace a null field with the word "omitted" to make this clearer, as our managers wish to alert the technicians who are leaving certain fields blank.

So far I have tried this:

if {TASKS.WOTYPE3} = "" then "omitted"

but that isn't working. I am not sure how to express a null field (or perhaps this field is not null and contains whitespace? I'm not sure). Any tips would be quite helpful.

Thanks!

Sigless and Bible Black
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 14 Jul 2009 at 3:04pm
try:
if isnull({TASKS.WOTYPE3}) or {TASKS.WOTYPE3} = "" then "omitted" else {TASKS.WOTYPE3}
IP IP Logged
NedSchneebly
Newbie
Newbie


Joined: 09 Jul 2009
Location: Canada
Online Status: Offline
Posts: 23
Quote NedSchneebly Replybullet Posted: 14 Jul 2009 at 3:10pm
Excellent! Thanks.

I was going to say that I also tried:

if !{TASKS.WOTYPE3} then "omitted"

(note the "not" qualifier '!"), but that is syntactically wrong.

You responded before I could post that though. Thanks for the tip!


Sigless and Bible Black
IP IP Logged
NedSchneebly
Newbie
Newbie


Joined: 09 Jul 2009
Location: Canada
Online Status: Offline
Posts: 23
Quote NedSchneebly Replybullet Posted: 17 Jul 2009 at 12:41pm

I tried to use this same piece of code using a date field:

if isnull({TASKS.DUEDATE}) or {TASKS.DUEDATE} = "" then "(omitted)" else {TASKS.DUEDATE}

and it gave me the error "A date-time is required". Is there some sort of casting I have to do? How does it evaluate a null date field?

Thanks!



Sigless and Bible Black
IP IP Logged
NedSchneebly
Newbie
Newbie


Joined: 09 Jul 2009
Location: Canada
Online Status: Offline
Posts: 23
Quote NedSchneebly Replybullet Posted: 17 Jul 2009 at 12:47pm

In this case, I do not really want to replace a missing DUEDATE with the word "omitted". I actually do not want to even read in any record where the DUEDATE field is missing. I couldn't figure out how to do that, which is why I figured I'd just swap it with a keyword (like omitted) and then work from there.

If you know of a way for me to just skip over records with no DUEDATE, that would even be more helpful. I tried doing it with "Select Expert", choosing
"is not in the period" but the choices provided are not really right for what I'm trying to do. Thanks.

Sigless and Bible Black
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 17 Jul 2009 at 12:55pm
Date fields are a bit different. You can use the select expert to filter your data.
If you want to only get data rows where a date exists:
isnull({table.datefield})=False
if you want rows that fall in a certain range
{table.datefield} in StartDate to EndDate
// This also excludes all NULLS becasue they will not meet the parameter of falling between the dates
 
IS this What you needed?
IP IP Logged
NedSchneebly
Newbie
Newbie


Joined: 09 Jul 2009
Location: Canada
Online Status: Offline
Posts: 23
Quote NedSchneebly Replybullet Posted: 17 Jul 2009 at 1:04pm

Thanks DBlank.

isnull ({TASKS.DUEDATE}) = FALSE

is exactly what I wanted.

I may have to do some delta math on dates now, but will start a new thread for that (but I'll read back through past posts first before doing so).

Thanks a lot!

Sigless and Bible Black
IP IP Logged
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