cancel
Showing results for 
Search instead for 
Did you mean: 

Crystal Report Formula French Salutation

Former Member
0 Kudos

I have this code below I'm not sure why it is nto running properly. WHen i run each separately, they all work but for some reason when i put them together in a longer formula

If IsNull({GfCnBio.GfCnBio_Spouse_ID}) and {GfCnBio.GfCnBio_Key_Indicator} = "I"

and {GfCnAttrCat_4.GfCnAttrCat_4_Description} = "French" and (Trim ({GfCnBio.GfCnBio_Title_1}) like "M.*")

then "Monsieur " + " " + {GfCnBio.GfCnBio_Last_Name}

Else if {GfCnBio.GfCnBio_Spouse_ID} <> 0 and {GfCnBio.GfCnBio_Key_Indicator} = "I"

and {GfCnAttrCat_4.GfCnAttrCat_4_Description} = "French" and (Trim ({GfCnBio.GfCnBio_Title_1}) like "M.*")

then "Monsieur " + " " + {GfCnBio.GfCnBio_Last_Name} + " " + "Madame " + {GfCnBio.GfCnBio_Last_Name}

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

and {GfCnAttrCat_4.GfCnAttrCat_4_Description} = "French" and (Trim ({GfCnBio.GfCnBio_Title_1}) like "M. et Mme.*")

then "Monsieur " + " " + {GfCnBio.GfCnBio_Last_Name}

else if {GfCnBio.GfCnBio_Spouse_ID} <> 0 and {GfCnBio.GfCnBio_Key_Indicator} = "I"

and {GfCnAttrCat_4.GfCnAttrCat_4_Description} = "French" and (Trim ({GfCnBio.GfCnBio_Title_1}) like "M. et Mme.*")

then "Monsieur " + " " + {GfCnBio.GfCnBio_Last_Name} + " " + "Madame " + {GfCnBio.GfCnBio_Last_Name}

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

and {GfCnAttrCat_4.GfCnAttrCat_4_Description} = "French" and (Trim ({GfCnBio.GfCnBio_Title_1}) like "Me.*")

then "Madame " + " " + {GfCnBio.GfCnBio_Last_Name}

else if {GfCnBio.GfCnBio_Spouse_ID} <> 0 and {GfCnBio.GfCnBio_Key_Indicator} = "I"

and {GfCnAttrCat_4.GfCnAttrCat_4_Description} = "French" and (Trim ({GfCnBio.GfCnBio_Title_1}) like "Me.*")

then "Madame " + " " + {GfCnBio.GfCnBio_Last_Name} + " " + "Monsieur " + {GfCnBio.GfCnBio_Last_Name}

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

and {GfCnAttrCat_4.GfCnAttrCat_4_Description} = "French" and (Trim ({GfCnBio.GfCnBio_Title_1}) like "Madam*")

then "Madame " + " " + {GfCnBio.GfCnBio_Last_Name}

else if {GfCnBio.GfCnBio_Spouse_ID} <> 0 and {GfCnBio.GfCnBio_Key_Indicator} = "I"

and {GfCnAttrCat_4.GfCnAttrCat_4_Description} = "French" and (Trim ({GfCnBio.GfCnBio_Title_1}) like "Madam*")

then "Madame " + " " + {GfCnBio.GfCnBio_Last_Name} + " " + "Monsieur " + {GfCnBio.GfCnBio_Last_Name}

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

and {GfCnAttrCat_4.GfCnAttrCat_4_Description} = "French" and (Trim ({GfCnBio.GfCnBio_Title_1}) like "M.*")

then "Monsieur " + " " + {GfCnBio.GfCnBio_Last_Name}

else if {GfCnBio.GfCnBio_Spouse_ID} <> 0 and {GfCnBio.GfCnBio_Key_Indicator} = "I"

and {GfCnAttrCat_4.GfCnAttrCat_4_Description} = "French" and (Trim ({GfCnBio.GfCnBio_Title_1}) like "M.*")

then "Monsieur " + " " + {GfCnBio.GfCnBio_Last_Name} + " " + "Madame " + {GfCnBio.GfCnBio_Last_Name}

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

and {GfCnAttrCat_4.GfCnAttrCat_4_Description} = "French" and

(Trim ({GfCnBio.GfCnBio_Title_1}) like "Mme.*" or Trim ({GfCnBio.GfCnBio_Title_1}) like "Mme")

then "Madame " + " " + {GfCnBio.GfCnBio_Last_Name}

else if {GfCnBio.GfCnBio_Spouse_ID} <> 0 and {GfCnBio.GfCnBio_Key_Indicator} = "I"

and {GfCnAttrCat_4.GfCnAttrCat_4_Description} = "French" and

(Trim ({GfCnBio.GfCnBio_Title_1}) like "Mme.*" or Trim ({GfCnBio.GfCnBio_Title_1}) like "Mme")

then "Madame " + " " + {GfCnBio.GfCnBio_Last_Name} + " " + "Monsieur" + {GfCnBio.GfCnBio_Last_Name}

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

and {GfCnAttrCat_4.GfCnAttrCat_4_Description} = "French" and

(Trim ({GfCnBio.GfCnBio_Title_1}) like "Mlle." or Trim ({GfCnBio.GfCnBio_Title_1}) like "Mlle")

then "Madame " + " " + {GfCnBio.GfCnBio_Last_Name}

else if {GfCnBio.GfCnBio_Spouse_ID} <> 0 and {GfCnBio.GfCnBio_Key_Indicator} = "I"

and {GfCnAttrCat_4.GfCnAttrCat_4_Description} = "French" and

(Trim ({GfCnBio.GfCnBio_Title_1}) like "Mlle." or Trim ({GfCnBio.GfCnBio_Title_1}) like "Mlle")

then "Madame " + " " + {GfCnBio.GfCnBio_Last_Name} + " " + "Monsieur " + {GfCnBio.GfCnBio_Last_Name}

else

"Madame, Monsieur"

when i run the above formula i do not get all the results i need.

but when i run the below part of the formula separetly, i get the results that i am missing from the above formula. I am not sure what i could be doing wrong here...

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

and {GfCnAttrCat_4.GfCnAttrCat_4_Description} = "French" and

(Trim ({GfCnBio.GfCnBio_Title_1}) like "Mme.*" or Trim ({GfCnBio.GfCnBio_Title_1}) like "Mme")

then "Madame " + " " + {GfCnBio.GfCnBio_Last_Name}

else if {GfCnBio.GfCnBio_Spouse_ID} <> 0 and {GfCnBio.GfCnBio_Key_Indicator} = "I"

and {GfCnAttrCat_4.GfCnAttrCat_4_Description} = "French" and

(Trim ({GfCnBio.GfCnBio_Title_1}) like "Mme.*" or Trim ({GfCnBio.GfCnBio_Title_1}) like "Mme")

then "Madame " + " " + {GfCnBio.GfCnBio_Last_Name} + " " + "Monsieur" + {GfCnSpSpBio.GfCnSpSpBio_Last_Name}

Accepted Solutions (0)

Answers (1)

Answers (1)

patrick_genest
Advisor
Advisor
0 Kudos

Hi Divyesh,

Since the formula isn't returning any error message, it looks like it could be a logical error that is causing the result to not be what you are expecting.

Since there is a lot of conditions to be fulfilled, it could happen that it meets the criteria for one set of conditions and then it doesn't go down to the next sets of conditions that you expected it to go to, as it went to another branch of the conditions. ( Hope this make sense. )

I will suggest to look at the formula and see what you are the common conditions, for each levels.

For example, maybe 5 of the conditions needs to fufill condition where the country is equal to USA and 3 where it is equal to Mexico, ...

Once you have all the logic down, then write the formula, but with only the higher level, and test if it returns the desired result, then add the second level of conditions and so on. In this way, you will find out right away if there is a logical error.

Hope this help!