on 04-23-2009 6:49 PM
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,"
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,";
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you very much for your help. I tried your solution and it worked very well.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
92 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.