Print Page | Close Window

Formula comparison Null or not Null

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=14704
Printed Date: 29 Apr 2024 at 5:50pm


Topic: Formula comparison Null or not Null
Posted By: shiloh
Subject: Formula comparison Null or not Null
Date Posted: 18 Oct 2011 at 6:00pm
Hi,

I do have a problems on this formula,

I have a formula field call "confirm", in side I put this

if ({?stdconfirm}) = 'Null'
then ToText ("SI - Non Confirm")
else If ({?stdconfirm}) = 'ALL'
then ToText ("SI - Confirm & Not Confirm")
else ToText ("SI - Confirm")

In the Selection Formula I put this

(
if {?stdconfirm} ='NULL'
then (isnull ({SI.DateConfirm}))
else
    if {?stdconfirm} ='ALL'
     then (isnull ({SI.DateConfirm})) and (not isnull ({SI.DateConfirm}))
    else
        if{?stdconfirm} <>'NULL'
        then (not isnull ({SI.DateConfirm}))
          else
          false
)

My result only shown "Null" and <>"Null" output. For "All" is did not appear.

Can anyone help me to solve this issue?
My dateconfirm field is datetime and allow null in the database table

Thanks a lot for the help

Regards,
shiloh




Replies:
Posted By: DBlank
Date Posted: 19 Oct 2011 at 3:55am
I would change your options to 'ALL', 'NULL' or 'NOT NULL'
then the select statement should be:
(
{?stdconfirm} ='ALL'
or
({?stdconfirm} ='NULL' and isnull({SI.DateConfirm})
or 
({?stdconfirm} = 'NOT NULL' and not (isnull ({SI.DateConfirm})) )
)



Posted By: shiloh
Date Posted: 19 Oct 2011 at 4:41pm
Originally posted by DBlank

I would change your options to 'ALL', 'NULL' or 'NOT NULL'
then the select statement should be:

(

{?stdconfirm} ='ALL'

or

({?stdconfirm} ='NULL' and isnull({SI.DateConfirm})

or ({?stdconfirm} = 'NOT NULL' and not (isnull ({SI.DateConfirm})) ))

Hi Dblank,

Thanks for your help

The report work prefect now.

Thanks a lot



Print Page | Close Window