AT Data Merge (0.1)
- AT Data Merge download link: http://plone.org/products/atdatamerge/releases/
- Homepage of AT Data Merge: http://plone.org/products/atdatamerge
- AT Data Merge repository: http://dev.plone.org/collective/browser/ATDataMerge
- Description source: http://dev.plone.org/collective/browser/ATDataMerge/trunk/README.txt
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.
DESCRIPTION AND USAGE
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.