cancel
Showing results for 
Search instead for 
Did you mean: 

Salutation for Crystal Report

Former Member
0 Kudos

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 ❤️ 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,"

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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}

else if{GfCnBio.GfCnBio_Key_Indicator} = "I" and IsNull({GfCnBio.GfCnBio_Last_Name})
then "Dear Friend,"

// Why aren't you checking for this if{GfCnBio.GfCnBio_Key_Indicator} = "I"?

// since the data in {GfCnBio.GfCnBio_First_Name} has to be > 2 characters, modify it thus

else if IsNull({GfCnBio.GfCnBio_Title_1}) and length({GfCnBio.GfCnBio_First_Name}) > 2 
and Not IsNull({GfCnBio.GfCnBio_Last_Name})
then "Dear" + " " + {GfCnBio.GfCnBio_First_Name}  + " " + {GfCnBio.GfCnBio_Last_Name}

// since the data in {GfCnBio.GfCnBio_First_Name} has to be < 3 characters, modify it thus

else if IsNull({GfCnBio.GfCnBio_Title_1}) and length({GfCnBio.GfCnBio_First_Name}) < 3 
and Not IsNull({GfCnBio.GfCnBio_Last_Name})
then "Dear Friend,"

// If for some reason none of the above conditions apply
else "Dear Friend,";

Answers (1)

Answers (1)

Former Member
0 Kudos

Thank you very much for your help. I tried your solution and it worked very well.