Crystal Reports and Null fields

10k views Asked by At

I'm using formula by grouping records in my report like this:

field1 + field2 + field3

But when a field inside the formula is null (for example field2) Crystal Reports not groups records properly; So I have to insert in the formula a condition like:

field1 + (if isnull(field2) then "" else field2) + field3

But there is a method to tell to Crystal Reports that when he find a null value it must return a default value that I have set?
Or is there a method to 'initialize' fields so that recognizes a null field as ""?

1

There are 1 answers

0
shA.t On BEST ANSWER

Use this:

TRIM(field1 & " ") & TRIM(field2 & " ") & TRIM(field3 & " ")

or

  1. Select from the top level menu File | Report Options.
  2. Look for the "Convert NULL field value to default" checkbox.

If this box is checked, NULL is returned as a special "automagical" DEFAULT value. This typically will convert NULL to zero in formulas and running totals.

Folks who are using newer versions of Crystal Reports will notice an additional checkbox in Report Options called "Convert Other NULL Values to Default".

This checkbox refers to the NULLs being returned by objects other than database rows (i.e. formulas and running totals). Typically a combination of both of these checkboxes is required to properly fix a zero totaling problem. (Depending on back-end database and usage)[1]