Skip to Content
0
Former Member
Apr 23, 2009 at 05:49 PM

Salutation for Crystal Report

39 Views

Hi There i am trying to write a formula for a salutation in a crystal report. I am trying to write a fomula to show the following.

 If Title, first name, and last name are all populated, please employ Dear <Title> <First Name> <Last Name,>

 If there is no last name employ <Dear Friend,>

 If there is no Title, but the data in first name > 2 characters and last name is populated, then employ Dear <First Name> <Last Name,>

 If there is no Title, but the data in first name <3 characters and last name is populated, then employ <Dear Friend,>

i have the following logic.

if {GfCnBio.GfCnBio_Key_Indicator} = "I" and Not IsNull({GfCnBio.GfCnBio_Title_1})

and Not IsNull({GfCnBio.GfCnBio_First_Name}) and Not IsNull({GfCnBio.GfCnBio_Last_Name})

then "Dear" + " " +{GfCnBio.GfCnBio_Title_1} + {GfCnBio.GfCnBio_First_Name} + " " + {GfCnBio.GfCnBio_Last_Name}

//this part works

//but the rest is not. I am not sure what i am doing wrong here

else if{GfCnBio.GfCnBio_Key_Indicator} = "I" and IsNull({GfCnBio.GfCnBio_Last_Name})

then "Dear Friend,"

else if IsNull({GfCnBio.GfCnBio_Title_1}) and ToNumber({GfCnBio.GfCnBio_First_Name})>=2

and Not IsNull({GfCnBio.GfCnBio_Last_Name})

then "Dear" + " " {GfCnBio.GfCnBio_First_Name} " " +{GfCnBio.GfCnBio_Last_Name}

else if IsNull({GfCnBio.GfCnBio_Title_1}) and ToNumber({GfCnBio.GfCnBio_First_Name})<=3

and Not IsNull({GfCnBio.GfCnBio_Last_Name})

then "Dear Friend,"