• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 499
  • Last Modified:

Crystal Formula-Null values

Hello all,
I have a crystal formula as below:
When any one of the field is null the report doesnt display data.How can I rewrite or handle this.
{Patients.NsID}+ " / " +{Patients.Room} +" / "+{Patients.Bed}

Open in new window

2 Solutions
Try this

Local StringVar strOutput;
If Not IsNull({Patients.NsID}) Then
    strOutput := {Patients.NsID} + " / "
    strOutput  := " / ";

If Not IsNull({Patients.Room}) Then
    strOutput  := strOutput  + {Patients.Room} + " / "
    strOutput  := strOutput  + " / ";

If Not IsNull({Patients.Bed}) Then
    strOutput  := strOutput  + {Patients.Bed};


Open in new window

You could also go to File > "Report Options" and check the "Convert database null values to default" option and a null field will be replaced by an empty string.  That option will effect almost every formula in a report, so if you actually need to see nulls in some formulas, you may not want to use that option.

 More recent versions of CR also include an option in the formula editor to control how that specific formula treats nulls, so you could see if you have that option.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now