You are here: Home Plone products AT Data Merge

AT Data Merge (0.1)

by Olha Pelishok last modified 2009-01-26
Released on 2007-01-08 by FairSay Ltd. for Plone 2.0, Plone 2.1, Plone 2.5 under GPL - GNU General Public License available for All platforms.
Software development stage: stable
ATDataMerge provides "mail merge" type functionality within other content.

This is a product that provides simple "mail merge" type functionality. It does that by providing custom fields and widgets that look up fields embedded in textual content and dynamically replace the fields with data, as instructed by the developer.


To data merge enable a content type, some textual AT fields or widgets must use DataMergeStringField (or DataMergeTextField), or DataMergeStringWidget (or DataMergeTextWidget). These are drop-in replacements for StringField & TextField & the corresponding widgets. There are subtle differences in the outcome depending on whether one uses the data merge fields or the corresponding widgets; it is a good idea to start with the fields.

The fields have two special properties: "data_method" and "separators". The data method should be set to the name of the data getter method (implemented by your content type) that is used to retrieve the data that is used in the data merge operation. The default name is "compileMergeData". The return value should be a dictionary containing {fieldname:replacement_value} key-value pairs that should both be strings.

The separators property is a two-character string (left & right separator) giving the characters that are used to identify field names among the "normal" content. By default the value is "[]".

The simplest way is to add a DataMergeStringField or a DataMergeTextField to your content type and implement the data method. Then, edit the field content & include [fieldname] in the field content. When viewing the content, the replacement value is shown, rather than '[fieldname]'. Obviously, the data getter must return a value for "fieldname", for whatever field name is used.

Document Actions
Powered by Plone