home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / WP / DINFO6.ZIP / 1023 < prev    next >
Text File  |  1994-01-05  |  7KB  |  192 lines

  1.                             WordPerfect Corporation
  2.                        InfoShare Information Fax Service
  3.                                 (800) 228-9960
  4.  
  5. Title:   Merge: Selecting Records to Print or Merge 
  6. Product: WordPerfect 5.1 for DOS 
  7. Number:  1023-1/94 
  8.  
  9. Problem
  10. This document describes how to print or merge selected records
  11. from a secondary merge file.
  12.  
  13.  
  14. Concept
  15. A secondary merge file is composed of pieces of information
  16. listed in a repeating pattern.  Each piece of information in the
  17. pattern fits into a designated field in a primary merge file. 
  18. When you merge a primary and secondary file, WordPerfect detects
  19. the field codes in the primary file and inserts the corresponding
  20. pieces of information from the secondary file into the designated
  21. fields.
  22.  
  23. The information in a secondary file is divided like a database
  24. into records and fields.  An {END FIELD} code followed by a hard
  25. return code ([HRt]) indicates the end of a field (or piece of
  26. information) in the secondary file.  An {END RECORD} code and a
  27. hard page code ([HPg]) indicate the end of a record (or repeating
  28. pattern) in a secondary file.
  29.  
  30. For example, three consecutive records in a secondary merge file
  31. might look like this on your screen:
  32.  
  33. Jason Huntington{END FIELD}
  34. 801-555-4321{END FIELD}
  35. 8910 State St.{END FIELD}
  36. Provo{END FIELD}
  37. UT{END FIELD}
  38. 84606{END FIELD}
  39. {END RECORD}
  40. ===================
  41. Gloria Cassidy{END FIELD}
  42. 801-555-1234{END FIELD}
  43. 1112 Center St.{END FIELD}
  44. Orem{END FIELD}
  45. UT{END FIELD}
  46. 84057{END FIELD}
  47. {END RECORD}
  48. ==================
  49. Kristen Black{END FIELD}
  50. 801-555-9876{END FIELD}
  51. 372 University Ave.{END FIELD}
  52. Provo{END FIELD}
  53. UT{END FIELD}
  54. 84604{END FIELD}
  55. {END RECORD}
  56. ===================
  57.  
  58. You may need to create a report that only includes part of the
  59. records from your secondary file.  For example, you may only need
  60. a list of customers in a certain area code or with the same last
  61. name.  There are two ways to generate such a report.
  62.  
  63.  
  64. Solutions
  65. All of these solutions will use the three merge records displayed
  66. in this document.  In all cases, we will only be searching for
  67. the records that list the city of Provo in field 4.
  68.  
  69. Solution 1
  70. Manually enter #{END FIELD} to indicate the fields you want to
  71. sort.  This can be done on any field in your record, but it is
  72. generally easier on the first field.  This solution is best if
  73. you are selecting random records where the information isn't
  74. uniform.  For example, the cities may all be different, the zip
  75. codes may not match, and so on. 
  76.  
  77. 1     Determine which field you will use as the marker field.  In
  78.       this example, we will place the marker after all other
  79.       fields, thereby creating a seventh field.
  80.  
  81. 2     Move to the beginning of the first record.  If this record
  82.       fits your criteria, move to the bottom of the record
  83.       (before the {END RECORD} but after the last {END FIELD}). 
  84.       Type # and press {END FIELD} (F9).  If it does not fit your
  85.       criteria, just press {END FIELD} (F9).  For this example,
  86.       the records for Jason Huntington and Kristen Black will
  87.       have #{END FIELD} on the first line.  The record for Gloria
  88.       Cassidy will simply have an {END FIELD}.
  89.  
  90. Adding an {END FIELD} to every record, whether it fits your
  91. criteria or not, ensures that there will be the same number of
  92. fields in each record.  At this point, you can either perform a
  93. sort and search for the pound sign, or you can use an {IF}
  94. statement to merge.
  95.  
  96. Once you have marked the records you want, there are two ways to
  97. select the information you want to print or merge.  One is to
  98. sort by the pound sign (#), and the other is to merge the file.
  99.  
  100. Method 1
  101. To perform the sort,
  102.  
  103. 1     Press Merge/Sort (Ctrl+F9), then choose Sort (2).  Press
  104.       Enter twice to go to the Sort screen.
  105.  
  106. 2     Choose Type (7), then choose Merge (1).  The title of the
  107.       sort screen will now be "Sort Secondary Merge File".
  108.  
  109. 3     Choose Keys (3).  Because this is an alphabetical sort, and
  110.       we are only looking at the first word of the first record
  111.       on the first line, the choices under Key 1 need to be a  7
  112.       1 1.  Press Exit when you have finished setting the keys.
  113.  
  114. 4     Choose Select (4).  Type key1=# so that the sort will only
  115.       select the records that have #{END FIELD} on the last line.
  116.  
  117.       Press Exit (F7) when you have finished setting your
  118.       selections.
  119.  
  120. 5     Choose Perform Action (1).
  121.       
  122. 6     Save the resulting file and run the merge with the original
  123.       primary file and this new secondary file.
  124.  
  125. Method 2
  126. To run the merge,
  127.  
  128. 1     Create a merge document with an {IF} statement in it.  This
  129.       will be your primary document.  The following commands are
  130.       the merge codes for this example.  They should be placed at
  131.       the top of your primary file.
  132.  
  133.             {LABEL}top~{IF}"{FIELD}7~"!="#"~{NEXT
  134.             RECORD}{GO}top~{END IF}{COMMENT}
  135.             ~{FIELD}1~
  136.             {FIELD}3~
  137.             {FIELD}4~ {FIELD}5~  {FIELD}6~
  138.  
  139. 2     Press Merge/Sort (Ctrl+F9), then choose Merge (1).
  140.  
  141. 3     Enter the names for your primary and secondary documents.
  142.  
  143. The merge will then extract only those records you have selected.
  144.  
  145. Solution 2
  146. Create a sort that will select the records that you need.  In
  147. this example, we will again search for all records containing the
  148. city of Provo.
  149.  
  150. 1     Retrieve the document that contains your secondary file.  
  151.  
  152. 2     Press Merge/Sort (Ctrl+F9), then choose Sort (2).  Press
  153.       Enter twice to go to the Sort screen.
  154.  
  155. 3     Choose Type (7), then choose Merge (1).  The title of the
  156.       sort screen will now be "Sort Secondary Merge File".
  157.  
  158. 4     Choose Keys (3).  Because this is an alphabetical sort, and
  159.       we are only looking at the first word of the first record
  160.       on the first line, the choices under Key 1 need to be a  4
  161.       1 1.  Press Exit when you have finished setting the keys.
  162.  
  163. 5     Choose Select (4).  Type key1=Provo so that the sort will
  164.       only select the records that contain the city of Provo in
  165.       the fourth field.  Press Exit when you are finished setting
  166.       your selections.
  167.  
  168. 6     Choose Perform Action (1).
  169.  
  170. When the sort is finished, only the records containing the city
  171. of Provo will be in your new document.
  172.  
  173. 7     Save the sort results under a new name and merge this
  174.       document with your primary file.
  175.  
  176.  
  177. See Also
  178. *     Appendix K: Macros and Merge, Programming Commands in the
  179.       WordPerfect
  180.       5.1 for DOS reference manual
  181. *     Sort in the WordPerfect 5.1 for DOS reference manual
  182.  
  183.  
  184.  
  185. WordPerfect Corporation 1994
  186.  
  187. WordPerfect Corporation
  188. 1555 N. Technology Way
  189. Orem, UT 84057-2399
  190.  
  191. WordPerfect is a registered trademark of WordPerfect Corporation
  192. within the United States and other countries.