Hammas_Stack1
Hammas_Stack1

Reputation: 182

Why Crystal Report Formula is not working to Group Data

I am using formula fields and have created this formula to group data on the basis of null or not. but it is not working and always group data in just one Completed group. Why ?

 if (Not IsNull({MRSReportProject_MRSReportClass.Actiontaken})) 
    and (IsNull({MRSReportProject_MRSReportClass.actioncomplete})) then "Pending"

    else if (Not IsNull({MRSReportProject_MRSReportClass.actioncomplete})) then "Completed"

else "Nothing";

Upvotes: 0

Views: 890

Answers (1)

Arvo
Arvo

Reputation: 10580

Most likely your null values are not null values.

One reason could be Crystal Report option convert null values to default - if this is checked, then formulas don't see null values, but empty strings or number 0, depend on field type.

Another possibility is that already your data source does not return null values.

You should then use simple comparison operators (=, <>) to compare values; if sometimes null values can occur, then you must consider all combinations (using both comparison operators and isnull() functions). I have sometimes used intermediate variables or formulas for eliminating null values, simplifies code a bit (some formulas can be pages long).

Upvotes: 1

Related Questions