Mozilla サポートの検索

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

詳しく学ぶ

このスレッドはアーカイブに保管されました。 必要であれば新たに質問してください。

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