Mailings - Customize the display format (MERGEFIELD)

March 2017



Issue


When doing a mail merge, it often happens that the merged numerical values ??are not displayed in the proper format, in the final document.
  • This is especially the case for dates, times, and sometimes the price.
  • It is useless to change the input format, the mailing (after being merged) retains the default format.

Solution


MERGEFIELD can be used to solve this issue.

Getting Started


The base document:
On the *, I sold for * of products, but this morning, between * and *, I lost for * of products.
Fields in the database:
Dat, Sale, Star, End, Loss.
After insertion of the fields in the basic document we obtain the the following:
On the "Dat", I sold for "Sale" of products, but this morning, between "Star" and "End", I lost for "Loss" of products
Enter the information on the different values in your database:
  • 25/03/08 1234,56 8:15 11:45 365
  • 12/04 123456,78 8:00 12:50 26,5

After the merging


After the merge, the preview features two letters:
  • On the 25/03/08, I sold for 1234,56 of products, but this morning, between 8:15 and 9:45, I lost for 365 of products.
  • On the 12/04,, I sold for 123456,78 of products, but this morning, between 8:00 and 12:50, I lost for 26,5 of products.

Toggle Field Codes


In your mail template, press [alt] + [F9] to get the following:
  • On the { MERGEFIELD "Dat"}, I sold for { MERGEFIELD "Sale"} of products, but this morning, between { MERGEFIELD "Star"} and { MERGEFIELD "End"}, I lost for { MERGEFIELD "Loss"} of products

The format codes

  • To get the date/hour (\@) format, with the day displayed two digits, month in letters and year as a four digits, add the following code: \@ "dd MMMM yyyy".
  • For a number (\#) format with the thousands separator, two decimal and eventually the euro symbol, add the following code: \# "# ##0,00 €".

Note that you need to use quotation marks to display empty spaces.

Formatting


The modified letter template
  • On the { MERGEFIELD "Dat" \@ "dd MMMM yyyy"}, I sold for { MERGEFIELD "Sale" \# "# ##0,00 €"} of products, but this morning, between { MERGEFIELD "Star" \@ "hh 'H' mm"} and { MERGEFIELD "End" \@ "h 'h' mm"}, I lost for { MERGEFIELD "Loss" \# "# ##0,00 €"} of products

After pressing [alt] + [F9]:
  • On the 25 March 2008, I sold for 1 234,56 € of products, but this morning, between 08 H 15 and 9 h 45, I lost for 365,00 € of products.
  • On the 12 April 2013, I sold for 123 456,78 € of products, but this morning, between 08 H 00 and 12 h 50, I lost for 26,50 € of products


Note that the keyboard shortcut [shift] + [F9] will toggle the display of the selected field only.

Related


Published by deri58.
This document, titled "Mailings - Customize the display format (MERGEFIELD)," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (ccm.net).