Autoforwarded: false
Content-type: TEXT
Importance: normal
Priority: non-urgent
UA-content-id: 116453DC0800
X-Hop-count: 1
Date-warning: Date header was inserted by mrgate.uwyo.edu
Newsgroups: bit.listserv.wpcorp-l
Date:         Fri, 10 Apr 1992 15:37:00 MDT
              <WPCORP-L@UBVM.BITNET>
From:         Nolan Letellier 766-6164 <NLETELL@CORRAL.UWYO.EDU>
Subject:      Re: {IF} in a merge...
X-To:         wpcorp-l@ubvm.cc.buffalo.edu

I don't know what you need to know, I will start with the assumption that
you can enter the commands but can't get them to work, or possibly don't
understand how to get them to work...
This is a prt-screen of a merge file I've created -- it is executed by a
macro, and uses macros to insert the secondary records into the
appropriate table depending on the contents of one of the fields...

{COMMENT}
~{ASSIGN}cpumodel~{FIELD}CPU Model~~{COMMENT}
~{ASSIGN}cpuserial~{FIELD}CPU Serial~~{COMMENT}
~{ASSIGN}monitrmodel~{FIELD}Monitor Model~~{COMMENT}
~{ASSIGN}monitrserial~{FIELD}Monitor Serial~~{COMMENT}    Merge variables only
~{ASSIGN}printrmodel~{FIELD}Printer Model~~{COMMENT}      have 7 sig. digits!
~{ASSIGN}printrserial~{FIELD}Printer Serial~~{COMMENT}
~{ASSIGN}othermodel~{FIELD}Other Model~~{COMMENT}
~{ASSIGN}otherserial~{FIELD}Other Serial~~{COMMENT}
~{ASSIGN}contnumber~{FIELD}Contract #~~{COMMENT}
~{NEST MACRO}mctop~{COMMENT}
~{IF}"Computer"="{FIELD}Contract Type~"~{COMMENT}
   ~{NEST MACRO}mcaddrow~{COMMENT}
   ~{COMMENT}
~{ELSE}{COMMENT}
   ~{NEST MACRO}mpaddrow~{COMMENT}
   ~{COMMENT}
~{END IF}

I don't know what to tell you to be of a lot of help.  I wrote
this a long time ago, and I don't remember what problems I had, but I
would be willing to field (no pun intended) a few specific questions...

FYI, the macros mcaddrow and mpaddrow add the current record to one of
two tables depending on the type of information contained in that
record.  This merge file is part of a "system" -- I'll try to explain it
clearly, but... (if you aren't that interested, this is a good time to
drop out)

The whole idea of the system is to get information from a mid-sized
database (1500+ records) under "dBase III+" into neat tables in WP 5.1.
1.  From an ASCII export file, the records are converted to a WP secondary
    merge file and loaded into WP.
2.  The user then "groups" records into information to be in a single
    file by blocking the appropriate records.
3.  The user then executes a macro which
    a.  copies the records to a temporary file
    b.  merges the temporary file with an initial document which contains
        introductory text and tables
    c.  Performs a little clean-up after the merge.
4.  The initial merge document does a {SUBST PRIMARY} to the file shown
    above which actually takes care of filling in the tables correctly.

To fill in the table, the information for a particular record is stored
to variables, then a macro (mcaddrow / mpaddrow) adds a row to the
corresponding table and enters the variables into the correct location.

You may have to use some combination of macros, primary files, and
blocking to accomplish what you have in mind.  Hopefully this will be
a poke in the right direction...

Nolan Letellier
nletell@corral.uwyo.edu
@-)

ps. in step one, the records are converted into a secondary merge
format outside of WP -- using a macro, even on a 386/33 was too slow.  I
wrote a short C program which uses an empty WP file and a list of
"changes" to convert the ASCII data directly to a WP loadable file.
It's ugly, but fast and very efficient.
Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU