home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / apps / powerbase / Docs / MailMerge < prev    next >
Encoding:
Text File  |  1994-10-01  |  12.1 KB  |  268 lines

  1.                 Mail-merging with Impression and Ovation
  2.                 ========================================
  3.  
  4. Although we have called this file ‘MailMerge’ the process to be described is
  5. more accurately termed “data-merge” since it is by no means limited to
  6. merging names and addresses into letters: any kind of textual data from a
  7. Powerbase application can be merged into any kind of Impression or Ovation
  8. document.
  9.  
  10. Mail-merging with Ovation
  11. =========================
  12. Ovation expects data for merging to be supplied as a CSV (comma-separated
  13. value) file. An example file (‘OvationCSV’) is supplied with this version of
  14. Powerbase. It was created from the ‘Elements’ database and is intended to
  15. work with the sample Ovation document ‘OmergeTest’. Before attempting to
  16. create CSV files of your own you are recommended to read the Powerbase
  17. documentation on such files. The process for mail-merging with Ovation is
  18. described below. 
  19.  
  20. Preparing an Ovation document for mail-merging
  21. ———————————————————————
  22. NOTE: This feature does not seem to be supported by Ovation prior to version
  23. 1.36 and it is to that version that the following information applies. I
  24. would like to take this opportunity to thank RISC Developments Ltd. for
  25. supplying a copy of Ovation to facilitate this documentation.
  26.  
  27. Ovation has a very easy method of specifying where the merged data is to go
  28. into the document. Whenever you reach a point where you wish to insert a
  29. Powerbase field type CTRL I. A small dialogue box (‘Merge tag’) will appear
  30. inviting you to enter a number. The number required is the field number in
  31. the CSV record (which is NOT necessarily the field number in the Powerbase
  32. record). If, for instance, you wish to merge the second field from each line
  33. of your CSV file enter 2 and type RETURN. You will see that [Merge2] has
  34. been inserted into the text at the caret. Continue typing, inserting other
  35. fields as required. The fields do not need to be in numerical order (you can
  36. insert field 2 before you insert field 1) and the same field may be inserted
  37. many times. Styles and effects may also be applied to the Merge tags. Load
  38. ‘MergeTest’ to see how this looks.
  39.  
  40. With ‘MergeTest’ loaded open the main Ovation menu, go to the ‘File’ submenu
  41. and choose ‘Print’. Select the ‘Mail merge’ option button and drag
  42. ‘OvationCSV’ to the writable icon to the right of the button. The pathname
  43. of the file will appear in the icon. Click on ‘OK’ and the document will be
  44. printed once for each record in the CSV file, merging new data into the
  45. document each time. ‘OvationCSV’ contains 10 records so if you just want to
  46. see the process in action without actually printing 10 sheets of paper set
  47. your printer manager to print to a file instead of to the printer itself.
  48.  
  49. If you examine ‘OvationCSV’ you will see that each field is enclosed in
  50. quotes. This is only necessary of the fields contain literal commas. Look at
  51. the first record, for example, and note the comma in “(Gr.aktis,aktinos; ray
  52. or beam)“. Without the quotes Ovation would interpret the comma as a field
  53. separator and the merging would be out of step for that record.
  54.  
  55. Mail-merging with Impression
  56. ============================
  57. Powerbase and Impression are able to communicate directly with each other
  58. without the need for a CSV file. This task is performed by a module called
  59. ImpulseII which Computer Concepts have placed in the public domain to
  60. encourage its adoption as a standard means of transferring data between RISC
  61. OS applications. The ImpulseII module is included in the ‘Resources’ folder
  62. inside the Powerbase application directory.
  63.  
  64. Preparing the Impression document
  65. ————————————————-
  66. Since the merged data is not being supplied from a pre-generated CSV file
  67. Impression needs to request specifically each Powerbase field that it
  68. wants to merge into the document. It is probably best to create the document
  69. without worrying about the merged data at first, then insert the necessary
  70. commands afterwards. 
  71.  
  72. Wherever you want data from a Powerbase record to appear in the document
  73. proceed as follows:-
  74.  
  75. (1) Place the caret at the point where the data is to be inserted.
  76.  
  77. (2) Click MENU over the frame, go to the ‘Misc’ submenu and choose ‘Merge
  78. command...‘. A dialogue box will appear.
  79.  
  80. (3) Type the following:-
  81.  
  82.                 :Powerbase GetField NAME
  83.  
  84. This is on the understanding that your Powerbase record contains a field
  85. whose tag is NAME and that you want the contents of that field inserting
  86. into the Impression document at that point. Note the spaces and the initial
  87. colon. These are essential.
  88.  
  89. (4) Click on ‘Set’ or type RETURN. You will see “<Merge>” appear in the
  90.     text.
  91.  
  92. (5) Repeat for all the other Powerbase fields to be inserted in the
  93.     document. All take the form :Powerbase GetField <tag>. All the data in a
  94.     given document must come from the same database. It might be easiest if
  95.     you open the required database and arrange the desktop so that you can
  96.     see both the record window and the Impression document. Clicking MENU
  97.     over a field makes its tag appear in the second menu item.
  98.  
  99. (6) Save the the document!
  100.  
  101. When you look at the document there is nothing to distinguish one merge
  102. command from another; they all appear as “<Merge>”. To check on what a
  103. command actually looks like open the ‘Merge command’ dialogue box again
  104. and place the caret at the beginning of the merge command, i.e. immediately
  105. before the initial “<”. The text of the command will then appear in the
  106. writable icon of the dialogue box.
  107.  
  108. Merging the data
  109. ————————
  110. (1) Make sure Impression has been “seen” by the filer. Impression doesn’t
  111.     need to actually be on the icon-bar at this point but it doesn’t matter
  112.     if it is. 
  113.  
  114. (2) Open the Powerbase database.
  115.  
  116. (3) Drop the Impression document on the record window. If Impression isn’t
  117.     already running Powerbase will run it for you. Assuming that the
  118.     document isn’t loaded already it will be loaded and displayed. Finally
  119.     Powerbase’s ‘Data merge’ dialogue box will appear. (If the document is
  120.     already loaded Impression will print a message informing you of this.
  121.     When you click on ‘OK’ the ‘Data merge’ box appears and you should then
  122.     display the Impression document with ‘New view’.)
  123.  
  124. (4) The ‘Data merge’ window has a writable icon in which you may enter a
  125.     search formula (see ‘!Tutorial’ and ‘Print’). Clicking on ‘Merge’ or
  126.     typing RETURN then extracts data from the first matching record and
  127.     inserts it in the specified places in the Impression document. If no
  128.     search formula was entered the merged record will be the first.
  129.  
  130. (5) Buttons are provided for “next”, “previous”, “first” and “last” record.
  131.     These work just like the corresponding keypad buttons and the Impression
  132.     document displays the merged data in each case.
  133.  
  134. (6) Clicking on ‘Print’ will print the Impression document in its displayed
  135.     state, i.e. with the currently merged data. If you select the ‘Print
  136.     all‘ switch then click on ’Merge‘ a whole series of hard copies will be
  137.     produced, one for each matching record.
  138.  
  139. (7) Note that when the mouse pointer is moved over the Impression document
  140.     after you have clicked on ‘Merge’ it changes to a large red and blue
  141.     cross which means that you cannot edit the document. Clicking SELECT
  142.     over it has no effect; the caret doesn’t appear. If you click on
  143.     ‘Cancel’ in the dialogue box the merged data is removed from the
  144.     document and normal editing is restored.
  145.  
  146. Mail-merging with other programs
  147. ================================
  148. If you use neither Impression nor Ovation you may still be able to use
  149. mail-merging with your wordprocessor, but you will need to read the manual
  150. carefully to find out how. It will almost certainly involve a CSV or similar
  151. file in conjunction with some method of “tagging” the document (as described
  152. above for Impression and Ovation) to specify where in it the data is to be
  153. merged.
  154.  
  155. Powerbase as an ‘Impulse’ server
  156. ================================
  157. The following is a description of the Impulse “methods” understood by
  158. Powerbase, given in the standard format recommended by Computer Concepts.
  159. Users wishing to write their own Impulse tasks to communicate with Powerbase
  160. will need this information. They will also need details of the SWIs to which
  161. Impulse will respond, and this information is obtainable from Computer
  162. Concepts. 
  163.     
  164. {methods: GetPathname
  165.         Selection <string>
  166.         ParseQuery <string>
  167.         GetField <tag>
  168.         GetRecord
  169.         PutFile
  170.         ExpandCode <string>
  171.         GetExpanded <string>
  172.  
  173. Descriptions:
  174. GetPathname
  175.  
  176. Specifies an ‘object’ i.e. a Powerbase database. If Powerbase has the
  177. required database open it replies with the full pathname of the object,
  178. otherwise it returns an error message. Example of use:
  179.  
  180.   :Powerbase !Elements GetPathname  (returns pathname of !Elements)
  181.  
  182. R6 points to pathname when calling task is decoding reply.
  183.  
  184. Selection <string>
  185.  
  186. Tells Powerbase about a field, or group of fields, in which the caller is
  187. interested. The fields are specified as a list of tags, separated by any
  188. suitable character (e.g. / or ,). The same separator must appear at the very
  189. end of the tag-list.  Powerbase replies with the maximum data-length of the
  190. combined fields in the selection. Example of use:
  191.  
  192.   :Powerbase Selection NAME/SYM/Z/
  193.  
  194. R6 points to a string which gives data-length.
  195.  
  196. ParseQuery <string>
  197.  
  198. Informs Powerbase of the criteria to be used in selecting records to
  199. transmit to the caller.  The parameter is a standard Powerbase search
  200. formula and Powerbase replies with the title which would normally appear
  201. at the head of one of its printed lists. Example of use:
  202.  
  203.   :Powerbase ParseQuery TYPE=T
  204.  
  205. R6 points to returned title.
  206.  
  207. GetField <tag>
  208.  
  209. Requests from Powerbase the data in the specified field of the next record
  210. which matches the preceding ParseQuery command.
  211.  
  212. When Powerbase replies to the GetField command the calling task should
  213. respond with an ImpulseFetchData, specifying the address and length of the
  214. buffer to be used, and then wait for an Impulse_receive event (reason code
  215. &204) before reading the buffer. 
  216.  
  217. GetRecord [<key>]
  218.  
  219. Sent without a key it requests from Powerbase the next record which matches
  220. the preceding ParseQuery command. If the primary key of a record in the
  221. database is appended then Powerbase will return the record corresponding to
  222. that key. The key must be separated from the GetRecord by a space. 
  223.  
  224. The calling task must follow the procedure described above for GetField.
  225. Powerbase will transmit the fields specified in the Selection command, using
  226. the same separator as was used in that command. Receipt of data may be
  227. followed by another GetRecord command, returning the next matching record
  228. and so on, a zero-length response signifying that there are no more
  229. matching records. If using keys to request specific records you should end
  230. by sending *** as a key to tell Powerbase that the dialogue is finished.
  231. This command and the one below operate only on Subfile 0 of the Powerbase
  232. database. 
  233.  
  234. PutRecord
  235.  
  236. Informs Powerbase that the caller wishes to write a record to the current
  237. Powerbase database. It should be sent as message type &200. A Selection
  238. command should have been previously sent to tell Powerbase what fields to
  239. expect and what separator is to be used. Powerbase will then reply with a
  240. GetRecord command (reason code &201) which the caller should acknowledge
  241. with message type &202, specifying the maximum length of the data which will
  242. be sent. Wait for event &203 which is a request by Powerbase for the caller
  243. to transmit the data. The caller should then do so with ImpulseTransmitData,
  244. specifying the buffer address and the length of data being sent. This may be
  245. immediately followed by  another PutRecord.
  246.  
  247. ExpandCode <string>
  248.  
  249. Requests the expanded form of a code used in a field linked to a validation
  250. table. The parameter string consists of the code itself, then a space,
  251. then the name of the validation table with the column number appended.
  252. Example of use:
  253.  
  254.   :Powerbase ExpandCode T Group0              
  255.  
  256. GetExpanded <string>
  257.  
  258. Combines the functions of GetField and ExpandCode, i.e. it requests the
  259. expanded form of the contents of a specified field. The parameter string is
  260. similar to that for ExpandCode, except that the field tag is substituted for
  261. the code. 
  262. Example of use:
  263.  
  264.   :Powerbase GetExpanded GP Group0
  265.  
  266. }
  267.  
  268.