.Net ramblings
# Thursday, 10 August 2006
Crystal Reports: join / concatenate null strings
I was getting blank fields in my crystal report if one of the values in the formula was null.
Thanks to this post i know better than to trust Crystal's crummy concatenation rules.  Here is what Gundula Wangerin had to say:
A string concatenated with null always gives null.
You have to check if the first name is null with
     if not IsNull(firstname) then 
        lastname + " " + firstname
    else
        lastname


Thursday, 10 August 2006 17:31:20 (GMT Daylight Time, UTC+01:00)  #    Comments [3]  .Net General | .Net Windows Forms | Asp.Net

Tuesday, 30 October 2007 21:14:44 (GMT Standard Time, UTC+00:00)
Bless You!!! I was pulling my hair out trying to figure out why the concatenate didn't work!!
Barbara
Thursday, 19 February 2009 15:36:28 (GMT Standard Time, UTC+00:00)
I would like to suggest an enhanced formula of the solution:

formula = lastname
if not isnull (firstname) then formula = formula + ", " + firstname

with the above formula, the comma between the last and first name will be added only if there is a first name.
Another advantage is when concatinting more than two string.

Hope this will be useful.

Thank you.
Osama Alborbar
Tuesday, 29 September 2009 20:00:58 (GMT Daylight Time, UTC+01:00)
In file menu go to report options then select convert null values to default option check box.
Then if any field is null it displays other fields and blank fields.

aditya
OpenID
Please login with either your OpenID above, or your details below.
Name
E-mail
Home page

Comment (Some html is allowed: a@href@title, strike) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

[Captcha]Enter the code shown (prevents robots):

Live Comment Preview