Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Concatenate Null Field in a Formula

Status
Not open for further replies.

BigSimmons

Programmer
Sep 25, 2002
1
US
Hi. I am running Crystal Reports 9 and have a small problem I can't figure out. I am concatenating database fields in a formula. When one of my field values is null the formula does not output any text at all.

Here's an example:
If IsNull({RPT_PM_SSC.CONTACT_MI}) Then
{RPT_PM_SSC.CONTACT_FIRST_NAME} + " " + {RPT_PM_SSC.CONTACT_LAST_NAME} + " " + {RPT_PM_SSC.SUFFIX_TYPE_SHORT_NAME}
Else
{RPT_PM_SSC.CONTACT_FIRST_NAME} + " " + {RPT_PM_SSC.CONTACT_MI} + " " + {RPT_PM_SSC.CONTACT_LAST_NAME} + " " + {RPT_PM_SSC.SUFFIX_TYPE_SHORT_NAME}

In this example if my "SUFFIX_TYPE_SHORT_NAME" is null I don't get anything to output. Any ideas?
 
Turn the convert null field values to default on in File->Report Options.

Now change your IF to look for "" instead of null:

If IsNull({RPT_PM_SSC.CONTACT_MI}) Then

will be:

If {RPT_PM_SSC.CONTACT_MI} = "" Then

-k kai@informeddatadecisions.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top