need assistance in handling null/blank fields

I have the following:

If {?DateType} = “Trx Date” then
(Command.Trx_Date) else (Command.Settle_Date)

But if (Command.Trx_Date) or (Command.Settle_Date) are null or blank, then I would like to show in Crystal Report Xi “N/A”

What’s the easiest way to put this in the CR formula editor for the report?

thx!


cestmoi (BOB member since 2013-07-02)

[Moderator Note: Moved from General Discussion to Crystal Reports]


Marek Chladny :slovakia: (BOB member since 2003-11-27)

To do a test for NULL you can use the IsNull function. So your code would look something like this:

If IsNull({?DateType}) then "N/A"
          else ...

the problem with this is that a function you can only return one data type, and if your Trx_Date and Settle_Date are type Date (or DateTime) then you can’t return N/A, which is a string.

To get around this you could try returning all values as strings, if you’re just displaying the dates and not sorting or grouping this could work. HTH.

-NifflerX


NifflerX (BOB member since 2009-08-09)

Thanks for the response…

I’ve already tested the fields and they are both DateTime fields… that’s not my issue…

i wonder if i can do something like this (i know this won’t work) in Crystal Formula editor:

If {?DateType} = ‘Order Date’
then NVL(Date({Command.ORDER_DATE}), ‘N/A’)
else NVL(Date({Command.ORDER_STATUS_UPDATED}), ‘N/A’)


cestmoi (BOB member since 2013-07-02)

It might be some thing like this:

If ISNULL({?DateType}) then ‘N/A’
ELSE IF {?DateType} = CDATE(Order Date) then CDATE({Command.ORDER_DATE}))
else CDate({Command.ORDER_STATUS_UPDATED})


k_mahesh9 (BOB member since 2012-01-30)