Thread: I'm Having Trouble Omitting Certain Words from Data Field
View Single Post
Old November 28th, 2016, 07:42 AM
StacyZ StacyZ is offline
Junior Community Member
Join Date: Feb 2016
Location: San Diego, CA
Posts: 18
Default Omitting Certain Words from Data Field


I'm trying to set up a rule for a two-language (double-sided) marketing letter, and I'm running into difficulty setting up the salutation.

One side of the letter is in German and the other is in French. My data is in German but I need to remove the German words from the Name field for the salutation on the French side of the letter.

Also, some of the records have a generic salutation and others are personalized with the customer's name.

Below is the rule I have so far:

if (Field("SALUT") == "Sehr geehrte Damen und Herren")
return "<span>" + RawText("Chère Madame cher Monsieur") + "</span>";
if (Field("SALUT").indexOf("Frau") > -1)
return "<span>" + RawText("Chère") + RawText(" ") + (Field("NAME") + "</span>");
if (Field("SALUT").indexOf("Herr") > -1)
return "<span>" + RawText("Cher") + RawText(" ") + (Field("NAME") + "</span>");
return "<span>" + RawText("Chère Madame cher Monsieur") + "</span>";
return "";

The first part of the rule addresses the generic records, "Sehr geehrte Damen und Herren" being the generic German salutation and "Chère Madame cher Monsieur" being the generic French salutation.

The 2nd and 3rd if statements address whether to use the feminine or masculine version of the French salutation. "Chère" being the feminine and "Cher" being the masculine.

All is working fine until we get to the part where we add the Name field. All of the names are listed the way we address German customers.

Examples: "Frau Alexandra Roth" (feminine)
"Herrn Roger Brand" (masculine)

The customer's names are actually Alexandra Roth and Roger Brand. I need to remove the "Frau" and the "Herrn" from the returned text. The end result needs to be "Chère Alexandra Roth" and "Cher Roger Brand" instead of "Chère Frau Alexandra Roth" and "Cher Herrn Roger Brand."

Any help would be greatly appreciated.

Thank you
Reply With Quote