| ||
|
Content blocks in templates can be controlled with the foreach and if keywords. Pdata keys and values are used in the batch or transaction Instruction File or the Batch Mailer CSV file to trigger control blocks. The syntax for the Control Block feature tags:
Foreach Control (looping)A foreach loop should contain a pdata key after the foreach: keyword. To print text in a template for every pdata fundname value, you would use the syntax:
Dear {{FirstName}} {{LastName}},
Your selected 401K funds are:
{{foreach:fundname}}
Investment Name: {{fundname}}
{{end}}
In this example, every pdata value for fundname will be printed in the order it is
provided in the Instruction File.An excerpt of the instruction file providing appropriate values would look like: ... <email id="000000012345" id2="401Kfunds"> <rcpt address="eDeliveryTest@epriority.com"/> <pdata key="FirstName" value="Jane"/> <pdata key="LastName" value="Doe"/> <pdata key="fundname" value="ABC Growth Fund"/> <pdata key="fundname" value="ABC Value Index Fund"/> <pdata key="fundname" value="ABC Large Cap Fund"/> </email> ...After processing the above Template example the resulting email would look like: Dear Jane Doe, Your selected 401K funds are: Investment Name: ABC Growth Fund Investment Name: ABC Value Index Fund Investment Name: ABC Large Cap Fund To use multiple pdata keys in a foreach loop, put each pdata field inside the loop text.
Dear {{FirstName}} {{LastName}},
Your selected 401K funds are:
{{foreach:fundname}}
Investment Name: {{fundname}} - fund info at {{fundurl}}
{{end}}
In this example, every pdata value for fundname and fundurl will be printed
in the order it is provided in the Instruction File.An excerpt of the instruction file providing appropriate values would look like: ... <email id="000000012345" id2="401Kfunds"> <rcpt address="eDeliveryTest@epriority.com"/> <pdata key="FirstName" value="Jane"/> <pdata key="LastName" value="Doe"/> <pdata key="fundname" value="ABC Growth Fund"/> <pdata key="fundurl" value="<a href="http://www.abcfunds.com/fund_info/growth">http://www.abcfunds.com/fund_info/growth</a>"/> <pdata key="fundname" value="ABC Value Index Fund"/> <pdata key="fundurl" value="<a href="http://www.abcfunds.com/fund_info/valueindex">http://www.abcfunds.com/fund_info/valueindex</a>"/> <pdata key="fundname" value="ABC Large Cap Fund"/> <pdata key="fundurl" value="<a href="http://www.abcfunds.com/fund_info/largecap">http://www.abcfunds.com/fund_info/largecap</a>"/> </email> ...After processing the above Template example the resulting email would look like: Dear Jane Doe, Your selected 401K funds are: Investment Name: ABC Growth Fund - fund info at http://www.abcfunds.com/fund_info/growth Investment Name: ABC Value Index Fund - fund info at http://www.abcfunds.com/fund_info/valueindex Investment Name: ABC Large Cap Fund - fund info at http://www.abcfunds.com/fund_info/largecap Ifexists ControlAn if block should contain a pdata key after the ifexists: keyword. If the pdata key is not supplied in the Instruction File, the text inside the ifexists block will not be printed. To print text in a template when pdata key paperless_customer is present, you would use the syntax:
Dear {{FirstName}} {{LastName}},
...
{{ifexists:paperless_customer}}
Thank you for choosing Paperless Documents for your Monthly Statements.
{{end}}
...
In this example, if pdata is present for paperless_customer, the text within the
if block will be printed.
An excerpt of the instruction file providing appropriate values would look like:... <email id="000000012345" id2="401Kfunds"> <rcpt address="eDeliveryTest@epriority.com"/> <pdata key="FirstName" value="Jane"/> <pdata key="LastName" value="Doe"/> <pdata key="paperless_customer" value="y"/> ...After processing the above Template example the resulting email would look like: Dear Jane Doe, ... Thank you for choosing Paperless Documents for your Monthly Statements. ... The pdata value for the ifexists: keyword can be referenced inside or outside the if control block and will be appropriately substituted. To print text in a template when pdata paperless_frequency is present and print the paperless_frequency value inside the ifexists block, you would use the syntax:
Dear {{FirstName}} {{LastName}},
...
{{ifexists:paperless_frequency}}
Thank you for choosing Paperless Documents for your {{paperless_frequency}} Statements.
{{end}}
...
In this example, if pdata is present for paperless_frequency, the text within the
if block will be printed and the value for paperless_frequency will be printed where referenced.
An excerpt of the instruction file providing appropriate values would look like:... <email id="000000012345" id2="401Kfunds"> <rcpt address="eDeliveryTest@epriority.com"/> <pdata key="FirstName" value="Jane"/> <pdata key="LastName" value="Doe"/> <pdata key="paperless_frequency" value="Quarterly"/> ...After processing the above Template example the resulting email would look like: Dear Jane Doe, ... Thank you for choosing Paperless Documents for your Quarterly Statements. ... If and Ifnot ControlsAn if and ifnot blocks should contain a pdata key after the if: and ifnot: keywords. If the pdata key is not supplied in the Instruction File, the text inside the if and ifnot blocks will not be printed. To print text in a template when pdata key due_date is present and populated or use a alternative text when not present or empty, you would use the syntax:
Dear {{FirstName}} {{LastName}},
...
{{if:due_date}}
Your next payment is due on {{due_date}} in the ammount of ${{due_amount}}.
{{end}}
{{ifnot:due_date}}
Your next payment will be automatically deducted via auto-pay in the amount of ${{due_amount}}.
{{end}}
...
In this example, if pdata is present for due_date, the text within the
if block will be printed. If the pdata key is not present or has an empty value, the ifnot text is printed.
An excerpt of the instruction file providing appropriate values would look like:... <email id="000000012345" id2="401Kfunds"> <rcpt address="eDeliveryTest@epriority.com"/> <pdata key="FirstName" value="Jane"/> <pdata key="LastName" value="Doe"/> <pdata key="due_date" value=""/> <pdata key="due_amount" value="127.88"/> ...After processing the above Template example the resulting email would look like: Dear Jane Doe, ... Your next payment will be automatically deducted via auto-pay in the amount of $127.88. ... The pdata value for the if: and ifnot: keywords can be referenced inside or outside the if/ifnot control blocks and will be appropriately substituted. To print text in a template when pdata due_amount is present and print the due_amount value inside the ifexists block, you would use the syntax:
Dear {{FirstName}} {{LastName}},
...
{{if:due_amount}}
Your current balance is ${{due_amount}} Statements.
{{end}}
...
In this example, if pdata is present and populated for due_amount, the text within the
if block will be printed and the value for due_amount will be printed where referenced.
An excerpt of the instruction file providing appropriate values would look like:... <email id="000000012345" id2="401Kfunds"> <rcpt address="eDeliveryTest@epriority.com"/> <pdata key="FirstName" value="Jane"/> <pdata key="LastName" value="Doe"/> <pdata key="due_amount" value="127.88"/> ...After processing the above Template example the resulting email would look like: Dear Jane Doe, ... Your current balance is $127.88 Statements. ... |