Home Index list of chapters
previous chapter next chapter
Ch 9 - Mail-merging with Ovation,
EasiWriter, Impression and Ovation Pro
Although the title refers to "mail-merging" the process to be described is more accurately termed "data-merging" since it is by no means limited to merging names and addresses into letters or labels; any kind of textual data from a Powerbase database can be merged into any kind of document in Impression or Ovation (including Ovation Pro) or many other editors and wordprocessors.
The following example documents which are referred to in the text may be downloaded from our website:
- OmergeTest and the companion file OvationCSV for use with Ovation (see Note 1)
- EWmerge and the companion file EasiWrCSV for use with EasiWriter
- OproMerge for use with Ovation Pro
- MergeTest for use with the Impression family
9.1 Mail-merging with Ovation
Ovation expects data for merging to be supplied as a CSV file. The example file (OvationCSV) was created from the Elements database and is intended to work with OmergeTest. Before attempting to create CSV files of your own you are recommended to read the relevant documentation on such files (see Ch 8). The process for mail-merging with Ovation is described below.
9.1.1 Preparing an Ovation document for mail-merging
If you load OmergeTest you will see a number of items of the form [Merge 1], [Merge 2] etc. These merge tags specify where the data derived from the CSV file is to go in the document and Ovation provides a very easy method of inserting them. Whenever you reach a point where you wish to insert an item from the CSV source file type Ctrl I. A window headed "Merge tag" will appear inviting you to enter a number. The number required is the field number in the CSV record (which is not necessarily the field number in the Powerbase record). If, for instance, you wish to merge the second field from each line of your CSV file enter 2 and type Return. You will see that [Merge2] has been inserted into the text at the caret. Continue typing, inserting other fields as required. The fields do not need to be in numerical order (you can insert field 2 before you insert field 1) and the same field may be inserted many times. Styles and effects may be applied to the Merge tags as can be seen from the fact that OmergeTest contains tags of different text size, with and without the application of bold or italics.
9.1.2 Merging the data from Powerbase
With OmergeTest loaded into Ovation, open the main menu, go to the File submenu and choose Print. Select the Mail merge option button and drag OvationCSV to the writable icon to the right of the button. The pathname of the file will appear in the icon. Click on OK and the document will be printed once for each record in the CSV file, merging new data into the document each time. OvationCSV contains 10 records so if you just want to see the process in action without actually printing 10 sheets of paper set your printer manager to print to a file instead of to the printer itself.
If you examine OvationCSV you will see that each field is enclosed in quotes. This is only necessary if the fields contain literal commas (see 8.1). Look at the first record, for example, and note the comma in "(Gr.aktis,aktinos; ray or beam)". Without the quotes Ovation would interpret the comma as a field separator and the merging would get out of step for that record.
9.2 Mail-merging with EasiWriter
The procedure described below is used for EasiWriter and TechWriter and appears to be unchanged since the earliest versions of these programs. (It works, for example, with TechWriter v.2.01, dated 17-Dec-1993!)
9.2.1 Preparing an EasiWriter document for mail-merging
As with Ovation a CSV file is used to supply data for merging into EasiWriter. The sample file EasiWrCSV is identical to OvationCSV except in one respect; there is a header line specifying the Powerbase field tags of the data in the file. Such files are easy to create (see 8.2). EasiWriter makes use of this file in a way different from Ovation which can best be seen as follows:
- Open a blank EasiWriter document
- Go to the Misc=>Merge submenu. (Note that the menu entry below the line is shaded at this stage and says No fields.)
- Choose File. The Merge file window will open.
- Make sure Headings is ticked, drag EasiWrCSV onto this window and click OK.
If you now return to the Misc=>Merge submenu you will see that the field tags from the first record in the CSV file are listed below the line. Choosing a tag (e.g. NAME) from this menu it causes it to appear at the caret in the document window looking like this: «NAME». This is a much better system than the one used by Ovation because you don't have to remember the order of fields in the CSV file and you can see which field will be merged at each point instead of merely seeing [Merge1] etc. (But see Note 2).
9.2.2 Merging the data
If you now load the sample EasiWriter document EWmerge you will see that merge tags «NAME», «GP» etc. are already present. However, if you choose File from the Misc=>Merge submenu you'll almost certainly find that the displayed pathname for the CSV file is not the pathname of EasiWrCSV on your system, so drop the file on the window again and click OK.
Now you're ready to merge the data! You do so by choosing Misc=>Print (which is only accessible if !Printers has been run). Make sure that both Merge and Preview are selected on the Print window and click the Print button. The first record will be merged. Repeatedly clicking Skip next will merge successive records without any actual printing so that you can see what's happening. Print will print the currently-merged record and Print all does what you'd expect.
9.3 Mail-merging with Impression and Ovation Pro
The following description applies to Impression Publisher and Impression Style. The older ImpressionII, and even Impression Junior, is also supported. The name "Impression" may be taken to refer to any of these.
Direct communication and data-transfer between Powerbase and Impression or Ovation Pro can take place without the need for a CSV file. This task is performed by a module called ImpulseII which Computer Concepts have placed in the public domain to encourage its adoption as a standard means of transferring data between RISC OS applications. The !Powerbase.Resources.Modules directory contains a copy of the ImpulseII module.
To use this method of data-transfer with Impression no preliminaries, other than the preparation of the document itself, are necessary but with OvationPro you must first do the following:
- Open the Applets subdirectory inside OvationPro and copy the !Impulse applet into it. If your OvationPro is a recent version, supplied on CD, you will find this applet in the DavidPilling.Applets directory.
- The filer also needs to have "seen" the !TransDDF filter which is in the directory DavidPilling.Filters on the CD. The !Boot and !Run files of this filter need to be modified to load ASCII DDF files as described in the !Help file.
9.3.1 Preparing the document for merging
Type the document in the normal way but leave about three spaces, instead of one, between words where data from a database is to be inserted. We need to insert at these points embedded merge tags which the wordprocessor will use to tell Powerbase what to transmit. Impression and Ovation Pro employ their own methods, described in their documentation, for entering merge tags, but Powerbase has its own provision for doing so and you will find this by far the easiest way of preparing the document.
Section 2.5.2 explained how fields can be dragged and dropped into a wordprocessor. If you hold down Shift and then drag and drop the effect is rather different. Open a blank Impression or Ovation Pro document and drag to it (without Shift) a field from a database, e.g. the NAME field from Elements. The contents of the field, i.e. the name of whatever element is displayed, will appear in the document. If you repeat the operation with Shift held down what you will see is:
- In Ovation Pro: the entry [Merge 1]. If you Shift-drag another field into the document it appears as [Merge 2] and so on. Although these look exactly like the merge tags described above in connection with Ovation their meaning is not the same: the numbers following the word Merge merely show the sequence in which the merge-tags have been inserted, whereas in Ovation they are the field-numbers in the CSV file (see above).
- In Impression Publisher: the Powerbase field tag in angle brackets, e.g. <NAME>. This is the most informative of the applications under discussion since it is the only one in which the relationship between merge tags and database fields is visible.
- In Impression II and Impression Junior: the entry <Merge>. This is the least informative of the applications; all merge tags are represented in exactly the same way.
These are the ways the applications use to show the presence of Impulse commands. The procedure described inserts the Impulse command GetField into the document. During a merge operation the GetField command will be sent to Powerbase which will pass back the contents of the field specified for insertion into the document.
There are two other useful Impulse commands supported by Powerbase and these require an alternative method for their insertion into the document. From the main menu choose Insert merge tags. The window which is displayed has a pop-up menu and bump icons to choose a field and a second pop-up menu to choose a command. First on this menu is GetField, although you'll probably find the method described above more convenient for inserting this command. Second is GetExpanded which can be used with fields linked to validation tables to insert data from any column of the table, the column being chosen from a submenu.
Merging usually produces one copy of the document per record. This isn't always what's required; sometimes we want to merge data from several records into the same copy of the document. NextMatch allows you to do that. Whenever a NextMatch command is encountered, Powerbase starts transmitting the data from the next matching record without issuing an instruction to print the document or start merging afresh. This opens up the possibility of producing very fancy reports by merging many records into a suitably-formatted document. When inserting a NextMatch command it doesn't matter what field you have displayed in the Insert merge commands window.
To insert a command into the document, first ensure that the correct field and command have been chosen, then place the caret at the required place in the document and drag the text file icon into the document from the Insert merge command window.
9.3.2 Merging the data
- Make sure the wordprocessor has been "seen" by the filer then open the database.
- Dropping the prepared document on the Record window opens the Data merge window. If the wordprocessor isn't already running Powerbase will run it for you.
- Clicking on Merge extracts data from either the first record or, if the Merge from displayed record button is set, the currently-displayed record, and inserts it in the specified places in the document. You can see this happening if the relevant parts of the document are visible. Using the tool-pane to browse, search or change subfiles or keys now causes the accessed records to be merged into the document instead of being displayed in the record window. Each time a record is merged its data overwrites that from the previous record. When merging is in effect the default action button on the window says Merging instead of Merge.
- If your printer is on-line and the printer driver loaded you may print the document with the merged data by clicking on Print. If the Print all button is selected before Merge is clicked Powerbase will proceed through the subfile either from the beginning or, if Merge from displayed record is selected, from part-way through the subfile, merging each record in turn and printing for each record a copy of the document containing the merged data. (See 9.2.1 regarding the NextMatch command to modify this behaviour.)
- More often than not you will want to print only those records with certain characteristics, but where do you enter a search formula to do that? The answer is to set up a filter (see 2.3.3) before clicking the Merge button to limit the merge to the records you're interested in. With Print all selected only the records matching the search formula will be printed.
- It is also possible to control merging via a script file (see Ch 12). Only the two commands !FILTER and !MAILMERGE (in that order) will normally be required.
If you are producing several documents during a merge operation (e.g. performing a mail-shot) clicking the Merging button pauses the process and the button legend changes to Paused. A further click changes it back to Merging and the process resumes at the place where it left off. This can be useful if, for example, you are using FastSpool+ which has a limit of 64 jobs in its queue. The Merge window shows how many items have been sent to the queue. By keeping an eye on this and pausing the merge to allow the queue to empty you can avoid the error which would occur on reaching the limit.
It's very easy to intiate a merge operation and then remember you should have selected Print all! If this happens to you, click Stop merging. The merged data is removed from the document and the default action button reverts to Merge. You can then select Print all and start the merge again. Cancel has a similar effect to Stop merging but also closes the Data merge window. However, there is nothing to stop you reopening it from the main menu (see Note 3) and resuming the merge process, provided the document is still open.
During a merge operation (i.e. as long as the default action button says Merging) you are prevented from editing the document. Moving the pointer over an Impression document under these conditions makes it change to a large red and blue cross and the caret can't be placed in the document. Over an Ovation Pro document there is no immediate indication but, as soon as you try to type anything, the message "Can't edit. Merge active on this document" is displayed. Both Cancel and Stop merging remove the merged data from the document and normal editing is restored. If you do want to edit the document with merged data present then click on Edit. Note, however, that if you save the document in this state it will be saved with the specific data you have merged into it rather than with the commands to merge data. Appendix A gives a full description of the Impulse commands or "methods" which Powerbase understands.
9.4 Mail-merging with other programs
If you don't use any of the wordprocessors covered you should still be able to use mail-merging with your wordprocessor, but you will need to read the manual carefully to find out how. It will almost certainly involve a CSV, or similar, file in conjunction with some method of "tagging" the document (as described above for Impression and Ovation) to specify where in it the data is to be merged.
Notes
1. This feature does not seem to be supported by Ovation prior to version 1.36 and it is to that version that this information applies. (back)
2. You can use a CSV file without a header to merge into EasiWriter. Repeat the procedure described but deselect the Headings button and drop OvationCSV on the window. The new entries in the Merge submenu now simply say Field1, Field2 etc. Note that these are not necessarily the Powerbase field numbers! (back)
3. If the Data merge window gets closed by mistake you can re-open it from the main menu by choosing Data merge. (back)

Home Index list of chapters
previous chapter next chapter