Этот сайт имеет ограниченную функциональность, пока мы проводим техническое обслуживание для улучшения его работы. Если какая-либо статья не решила вашу проблему и вы хотите задать вопрос, наше сообщество поддержки ждёт вас: @FirefoxSupport в Твиттере и /r/firefox на Reddit.

Поиск в Поддержке

Избегайте мошенников, выдающих себя за службу поддержки. Мы никогда не попросим вас позвонить, отправить текстовое сообщение или поделиться личной информацией. Сообщайте о подозрительной активности, используя функцию «Пожаловаться».

Подробнее

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

  • 1 ответ
  • 1 имеет эту проблему
  • 10 просмотров
  • Последний ответ от Nap_BlownApart

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.,,,,,,,,,,,,

Изменено Nap_BlownApart

Выбранное решение

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`.

Прочитайте этот ответ в контексте 👍 0

Все ответы (1)

more options

Выбранное решение

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`.