Ce site disposera de fonctionnalités limitées pendant que nous effectuons des opérations de maintenance en vue de vous proposer un meilleur service. Si un article ne règle pas votre problème et que vous souhaitez poser une question, notre communauté d’assistance est prête à vous répondre via @FirefoxSupport sur Twitter, et /r/firefox sur Reddit.

Rechercher dans l’assistance

Évitez les escroqueries à l’assistance. Nous ne vous demanderons jamais d’appeler ou d’envoyer un SMS à un numéro de téléphone ou de partager des informations personnelles. Veuillez signaler toute activité suspecte en utilisant l’option « Signaler un abus ».

En savoir plus

Mail Merge conditional on field ending with a period produces wrong result

more options

I am trying to make the salutation in my email conditional on whether the recipient has a Job Title or not, but it isn't working properly. The email is sent, but the salutation is always "Dear {{First Name}},", even though the {{Job Title}} later prints as 'Dr.', which ends with a period. I need to test for the period character as I have other titles that follow the same rule.

It appears that the If/Then/Else isn't working properly. Would anyone know what I'm doing wrong?


In the body of my mail, I have the following, which always ends up printing "Dear {{First Name}},":

   Dear {{{{Job Title}}|$|.|{{Job Title}} {{Last Name}}|{{First Name}}}},
   
   Print
   {{Job Title}}
   {{Last Name}}
   {{First Name}}
   End

When I change the code to the following, the Job Title prints as expected:

   Dear {{{{Job Title}}|$|.|{{Job Title}}}},
   
   Print
   {{Job Title}}
   {{Last Name}}
   {{First Name}}
   End


In my CSV file, I have the following:

   First Name,Last Name,Display Name,Nickname,Primary Email,Secondary Email,Screen Name,Work Phone,Home Phone,Fax Number,Pager Number,Mobile Number,Home Address,Home Address 2,Home City,Home State,Home ZipCode,Home Country,Work Address,Work Address 2,Work City,Work State,Work ZipCode,Work Country,Job Title,Department,Organization,Web Page 1,Web Page 2,Birth Year,Birth Month,Birth Day,Custom 1,Custom 2,Custom 3,Custom 4,Notes
   MyFirstName,MyLastName,MyFirstName MyLastName,,me@myemail.com,,,,,,,,,,,,,,,,,,,,Dr.,,,,,,,,,,,,
I am trying to make the salutation in my email conditional on whether the recipient has a Job Title or not, but it isn't working properly. The email is sent, but the salutation is always "Dear {{First Name}},", even though the {{Job Title}} later prints as 'Dr.', which ends with a period. I need to test for the period character as I have other titles that follow the same rule. It appears that the If/Then/Else isn't working properly. Would anyone know what I'm doing wrong? In the body of my mail, I have the following, which always ends up printing "Dear {{First Name}},": Dear {{{{Job Title}}|$|.|{{Job Title}} {{Last Name}}|{{First Name}}}}, Print {{Job Title}} {{Last Name}} {{First Name}} End When I change the code to the following, the Job Title prints as expected: Dear {{{{Job Title}}|$|.|{{Job Title}}}}, Print {{Job Title}} {{Last Name}} {{First Name}} End In my CSV file, I have the following: First Name,Last Name,Display Name,Nickname,Primary Email,Secondary Email,Screen Name,Work Phone,Home Phone,Fax Number,Pager Number,Mobile Number,Home Address,Home Address 2,Home City,Home State,Home ZipCode,Home Country,Work Address,Work Address 2,Work City,Work State,Work ZipCode,Work Country,Job Title,Department,Organization,Web Page 1,Web Page 2,Birth Year,Birth Month,Birth Day,Custom 1,Custom 2,Custom 3,Custom 4,Notes MyFirstName,MyLastName,MyFirstName MyLastName,,me@myemail.com,,,,,,,,,,,,,,,,,,,,Dr.,,,,,,,,,,,,

Modifié le par Nap_BlownApart

Solution choisie

Alexander, the developer of the Mail Merge addon, contacted me about this problem and explained what I had done wrong. Here is a summary, in my words, that should assist others with the same problem.

You have a syntax issue based on a misunderstanding of the documentation.

The conditional syntax is actually an extension of how variables are represented, rather than a separate construct. Therefore, the statement should be:

Dear {{Job Title|$|.|{{Job Title}} {{Last Name}}|{{First Name}}}},

Notice the lack of curly brackets around the first `Job Title`.

Lire cette réponse dans son contexte 👍 0

Toutes les réponses (1)

more options

Solution choisie

Alexander, the developer of the Mail Merge addon, contacted me about this problem and explained what I had done wrong. Here is a summary, in my words, that should assist others with the same problem.

You have a syntax issue based on a misunderstanding of the documentation.

The conditional syntax is actually an extension of how variables are represented, rather than a separate construct. Therefore, the statement should be:

Dear {{Job Title|$|.|{{Job Title}} {{Last Name}}|{{First Name}}}},

Notice the lack of curly brackets around the first `Job Title`.