Go Back   MarcomCentral (PTI) and FusionPro User Communities > Support > Issues, Questions, Etc.

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old November 28th, 2016, 08:42 AM
StacyZ StacyZ is offline
Forum n00b
 
Join Date: Feb 2016
Location: San Diego, CA
Posts: 9
Default Omitting Certain Words from Data Field

Hi,

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>");
}
else
{
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
  #2  
Old November 28th, 2016, 10:14 AM
step's Avatar
step step is offline
Senior Contributor
 
Join Date: Jan 2010
Location: Charlotte, NC
Posts: 955
Default Re: Omitting Certain Words from Data Field

You can replace the German words with the French words in the "NAME" field by using the replace method:
Code:
return Field("NAME").replace('Herrn', 'Cher').replace('Frau','Chère');
You could do the same for your generic salutation, as well:
Code:
return Field("SALUT").replace("Sehr geehrte Damen und Herren", "Chère Madame cher Monsieur");
If you're goal is to return the generic salutation when the "NAME" field is empty and otherwise return the value of the "NAME" field translated to French you could remove all of your 'if/else' statements and simplify your code:
Code:
return Field("NAME") ? Field("NAME").replace('Herrn', 'Cher').replace('Frau','Chère') : "Chère Madame cher Monsieur";
__________________
Ste Pennell
FusionPro VDP Creator 9.3.15
Adobe Acrobat X 10.1.1
Mac OS X 10.12

LinkedIn
Reply With Quote
  #3  
Old November 28th, 2016, 11:22 AM
StacyZ StacyZ is offline
Forum n00b
 
Join Date: Feb 2016
Location: San Diego, CA
Posts: 9
Default Re: Omitting Certain Words from Data Field

Hi Step,

This works perfectly!

Thank you so much.
Reply With Quote
Reply

Tags
data, multi-language, removing words, salutations

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 02:04 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.