Integrating ORACLE and WordPerfect

From: Michael Stowe <Michael.Stowe_at_f573.n115.z1.fidonet.org>
Date: Fri, 02 Dec 94 11:29:30 -0600
Message-ID: <786367770_at_f573.n115.z1.ftn>


  • Quoting Pp001758_at_Interramp.Com to All dated 11-30-94 ***
    > I am trying (unsuccessfully) to merge data from my ORACLE database into
    > WordPerfect documents. The documentation for WP does not help at all.

First make sure you can perform a query from the Oracle database. It requires that SQL*Net for Windows (I assume you are using the Windows version of WordPerfect) be properly installed, and version 6.0a or 6.1 of WordPerfect. It doesn't sound like the initial connection is your problem, though...

> ----MERGE BLOCK 1----
> Customer name and
> Address (merge from database)
> ---------------------
> ----MERGE BLOCK 2----
> item 1 purchased
> item 2 purchased
> ..
> item n purchased
> ---------------------
> Is there an "easy" way to do this?

Since you have easy in quotes, I'll say yes. :)

There are several approaches; I will attempt to describe only one, which I consider the easiest. In it, the SQL statement is simply treated as a non-master detail query, and WordPerfect is used to properly combine records, based on key fields being similar. The easiest way to accomplish this, is to use the first merge file to create a second merge file, with the rows rotated into columns. The merge commands look similar to the following: ASSIGN(wpvar, "Seed Value") ASSIGN(wpvarlast) LABEL(buildnewfile)
ASSIGN(wpvarlast; wpvar) ASSIGN(wpvar; oraclekeyfield)

IF(VARIABLE(wpvar) = VARIABLE(wpvarlast))

   FIELD(oracle_customer_item)MRGCMND(ENDFIELD) ELSE
   MRGCMND(ENDRECORD) FIELD(oracle_name)MRGCMND(ENDFIELD)    FIELD(oracle_address)MRGCMND(ENDFIELD)    FIELD(oracle_customer_item)MRGCMND(ENDFIELD) ENDIF
NEXT RECORD
GO(buildnewfile)

In other words, you first create a simple master-detail query, which creates a merge file. The first ("raw") merge file contains one record per row, so that names and addresses are duplicated everywhere (if you have a unique key value, I suggest you include it.) The first ("raw") merge file is used to build a second merge file. The second merge file contains one record per logical page -- an address block, followed by an arbitrary number of customer items. It is then (relatively) simple to use this second merge file to create the desired document.

Note that the WordPerfect merge codes I described will need to be modified somewhat for use in your application, and the formatting I inserted for readability you will want to take out, otherwise it will appear in your merge file. Received on Fri Dec 02 1994 - 18:29:30 CET

Original text of this message