Report Generator - Mail Merge Documents


Datafile Software

Report Generator - Mail Merge Documents

The existing Word options within the likes of the Ledger Enquiry allow the creation of word documents based on a template but on an account-by-account (or record-by-record) basis. To run a general merge process against multiple accounts/records you would have to output the merge items as a CSV or XLS file and then use standard Word functions to create the mail merge document(s). This works well but does require the operator to understand the Word Mail Merge functions and didn’t save the document into the Datafile system for later review.

This new feature, added to Report Generator, allows a new ‘Mail Merge’ report type that links to a pre-defined template and processes against selective records in the database merges the data and optionally prints and saves the document.

 Note

 This feature requires the R60WORD= entry within the DATAFILE.INI to be active (i.e. not set to R60WORD=FALSE) and the template uses the WP.DLL rather than the older DATAFILE.DOT file.

This feature is only currently applicable for the main application database.

Report Generator Definition

To define a new entry you must first have created the mail merge template. This is achieved through the standard template definition options within the Word link – select the Ledger Enquiry for the application required, select any account/record and then select the WORD option and then Maintain Template. See the Release 6.0 Supplement for more details on this aspect. Once the template has been created you can then link this template into a Report Generator Mail Merge.

To define mail merges select the Report Generator option and move down to a blank entry and press <Enter>.


Report Title – Select the title of this Report Generator entry.

Report on File – Select the file to base the report generator mail merge upon.Note that the Mail Merge functions are only applicable against the main database of an application accessible through the Ledger Enquiry – i.e. Sales Accounts but not Sales Transactions.

Type of Report – a new option has been added to the drop down list for Mail Merge

Authority Level – set from 0-9 as required restricting this Report Generator option to users on specific authority level or higher. Note that 9 is the lowest authority and 0 is the highest.

Only for User-Id – set a specific user-id to restrict this report generator option to, leave blank to make available for all users (subject to authority level)

Link to Company – select the company this option is linked to.Note for Mail Merge functions this option is mandatory.

Once confirmed the system then displays the Mail Merge parameter screens.


General Parameters– General Parameter options allow you to select the template you wish to create the merge against.


Mail Merge Title – defaulting to the initial title entered in the Report Generator parameter screen confirm/amend as required.

Mail Merge Template – select the required template (<F4-Select> is available).

Type of Mail Merge – select the type of Mail Merge. Three options are available:

Merge, Save & Print – this option creates a merge document for each account/record (subject to selection criteria), saves a copy of the document against each account/record and prints the document. Note that the document is printed to the operating system default printer.

Merge & Print Only – this option creates a merge document for each account/record and prints the document but doesn’t save a copy against the account/record.

Merge & Save Only – this option creates a merge document for each account/record and saves the document but doesn’t print a copy.

Append Today’s Date to Saved Filename – if saving a copy of the merged document the system uses the template filename as the filename for the merged document. As the document is saved on account basis this means that if you run the template multiple times for an account the system will overwrite (subject to setting below) each time and not keep a history of the documents sent. Setting this option appends today’s date to the filename so that multiple copies are retained.

Append User Comment to Saved Filename – as an alternative (or in addition to) appending today’s date the system can append a comment entered at run-time to the filename.

Overwrite Existing Files of Same Name – set whether to allow overwrite of existing files. If not set then the system will omit the save of documents where a document with the same file name (including the comment / today’s date suffix) would be generated.

Leave Document Window Open After Merge – applicable for the Merge & Save option only this option merges one account/record and leaves Word/Open Office with the merged document open this document can then be amended/printed as required. When close Word the system moves on to the next account/record which can then be amended/printed and so on.

Selection Criteria – this option allows the standard selection criteria functions for a report listing in report generator allowing you to define the criteria and control whether the criteria can be amended at run-time and if any such amendments are to be saved.


Report Sequence – this option allows for the standard report sequence options allowing selection of 1- record entry sequence, 2 – prime index sequence or 3 – user defined sequence. Select as required.

Update Report Layout and Exit – select to save changes and return to the menu.

Report Generator Mail Merge in Use

When running the Mail Merge routine options available include:


Today’s Date – defaulting to system date this is the date appended to the document filename where appropriate.

Selective Records to be Processed – tick box indicating whether selection criteria are configured (or not). If enabled, and the operator is allowed to amend the criteria, then as you <Enter> through this parameter the criteria will be displayed for confirm/amendment.

Type of Mail Merge – defaulting to the configured merge type you can amend this as required. Note that if the merge type is amended the system will revert to the definition merge type for next run.

Comment to append to Filename – enter comment to be appended to filename if the mail merge is to be saved against the account / record.

Processing – when processing a mail merge a new document is created against the template for each applicable record on the database and Microsoft Word/Open Office is opened, the data items are merged and the document printed and saved where applicable before Word / Open Office is closed. The Microsoft Word splash screen is displayed as the document is opened.

If the mail merge document is set to Merge and Save and the parameters are set to ‘Leave Document Window Open after Merge’ then Microsoft Word / Open Office is opened, the data items are merged and the document saved but Word / Open Office is left open for any amendments as required. When save/exit from Word then Datafile will move to the next account / record and repeat the process until all accounts / records have been processed.


Custom Fields

Article ID: 113
Created On: Mon, Jun 11, 2012 at 11:59 AM
Last Updated On: Tue, Jun 20, 2023 at 6:25 PM

Online URL: https://kb.datafile.co.uk/article/report-generator-mail-merge-documents-113.html