home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1994 #1
/
monster.zip
/
monster
/
WP
/
DINFO6.ZIP
/
1023
< prev
next >
Wrap
Text File
|
1994-01-05
|
7KB
|
192 lines
WordPerfect Corporation
InfoShare Information Fax Service
(800) 228-9960
Title: Merge: Selecting Records to Print or Merge
Product: WordPerfect 5.1 for DOS
Number: 1023-1/94
Problem
This document describes how to print or merge selected records
from a secondary merge file.
Concept
A secondary merge file is composed of pieces of information
listed in a repeating pattern. Each piece of information in the
pattern fits into a designated field in a primary merge file.
When you merge a primary and secondary file, WordPerfect detects
the field codes in the primary file and inserts the corresponding
pieces of information from the secondary file into the designated
fields.
The information in a secondary file is divided like a database
into records and fields. An {END FIELD} code followed by a hard
return code ([HRt]) indicates the end of a field (or piece of
information) in the secondary file. An {END RECORD} code and a
hard page code ([HPg]) indicate the end of a record (or repeating
pattern) in a secondary file.
For example, three consecutive records in a secondary merge file
might look like this on your screen:
Jason Huntington{END FIELD}
801-555-4321{END FIELD}
8910 State St.{END FIELD}
Provo{END FIELD}
UT{END FIELD}
84606{END FIELD}
{END RECORD}
===================
Gloria Cassidy{END FIELD}
801-555-1234{END FIELD}
1112 Center St.{END FIELD}
Orem{END FIELD}
UT{END FIELD}
84057{END FIELD}
{END RECORD}
==================
Kristen Black{END FIELD}
801-555-9876{END FIELD}
372 University Ave.{END FIELD}
Provo{END FIELD}
UT{END FIELD}
84604{END FIELD}
{END RECORD}
===================
You may need to create a report that only includes part of the
records from your secondary file. For example, you may only need
a list of customers in a certain area code or with the same last
name. There are two ways to generate such a report.
Solutions
All of these solutions will use the three merge records displayed
in this document. In all cases, we will only be searching for
the records that list the city of Provo in field 4.
Solution 1
Manually enter #{END FIELD} to indicate the fields you want to
sort. This can be done on any field in your record, but it is
generally easier on the first field. This solution is best if
you are selecting random records where the information isn't
uniform. For example, the cities may all be different, the zip
codes may not match, and so on.
1 Determine which field you will use as the marker field. In
this example, we will place the marker after all other
fields, thereby creating a seventh field.
2 Move to the beginning of the first record. If this record
fits your criteria, move to the bottom of the record
(before the {END RECORD} but after the last {END FIELD}).
Type # and press {END FIELD} (F9). If it does not fit your
criteria, just press {END FIELD} (F9). For this example,
the records for Jason Huntington and Kristen Black will
have #{END FIELD} on the first line. The record for Gloria
Cassidy will simply have an {END FIELD}.
Adding an {END FIELD} to every record, whether it fits your
criteria or not, ensures that there will be the same number of
fields in each record. At this point, you can either perform a
sort and search for the pound sign, or you can use an {IF}
statement to merge.
Once you have marked the records you want, there are two ways to
select the information you want to print or merge. One is to
sort by the pound sign (#), and the other is to merge the file.
Method 1
To perform the sort,
1 Press Merge/Sort (Ctrl+F9), then choose Sort (2). Press
Enter twice to go to the Sort screen.
2 Choose Type (7), then choose Merge (1). The title of the
sort screen will now be "Sort Secondary Merge File".
3 Choose Keys (3). Because this is an alphabetical sort, and
we are only looking at the first word of the first record
on the first line, the choices under Key 1 need to be a 7
1 1. Press Exit when you have finished setting the keys.
4 Choose Select (4). Type key1=# so that the sort will only
select the records that have #{END FIELD} on the last line.
Press Exit (F7) when you have finished setting your
selections.
5 Choose Perform Action (1).
6 Save the resulting file and run the merge with the original
primary file and this new secondary file.
Method 2
To run the merge,
1 Create a merge document with an {IF} statement in it. This
will be your primary document. The following commands are
the merge codes for this example. They should be placed at
the top of your primary file.
{LABEL}top~{IF}"{FIELD}7~"!="#"~{NEXT
RECORD}{GO}top~{END IF}{COMMENT}
~{FIELD}1~
{FIELD}3~
{FIELD}4~ {FIELD}5~ {FIELD}6~
2 Press Merge/Sort (Ctrl+F9), then choose Merge (1).
3 Enter the names for your primary and secondary documents.
The merge will then extract only those records you have selected.
Solution 2
Create a sort that will select the records that you need. In
this example, we will again search for all records containing the
city of Provo.
1 Retrieve the document that contains your secondary file.
2 Press Merge/Sort (Ctrl+F9), then choose Sort (2). Press
Enter twice to go to the Sort screen.
3 Choose Type (7), then choose Merge (1). The title of the
sort screen will now be "Sort Secondary Merge File".
4 Choose Keys (3). Because this is an alphabetical sort, and
we are only looking at the first word of the first record
on the first line, the choices under Key 1 need to be a 4
1 1. Press Exit when you have finished setting the keys.
5 Choose Select (4). Type key1=Provo so that the sort will
only select the records that contain the city of Provo in
the fourth field. Press Exit when you are finished setting
your selections.
6 Choose Perform Action (1).
When the sort is finished, only the records containing the city
of Provo will be in your new document.
7 Save the sort results under a new name and merge this
document with your primary file.
See Also
* Appendix K: Macros and Merge, Programming Commands in the
WordPerfect
5.1 for DOS reference manual
* Sort in the WordPerfect 5.1 for DOS reference manual
WordPerfect Corporation 1994
WordPerfect Corporation
1555 N. Technology Way
Orem, UT 84057-2399
WordPerfect is a registered trademark of WordPerfect Corporation
within the United States and other countries.