Re: Duplicating Details When Master Duplicated

From: QuadTwin <quadtwin_at_aol.com>
Date: 1997/04/25
Message-ID: <19970425134700.JAA05745_at_ladder01.news.aol.com>#1/1


<robbk_at_kelman.ab.ca> wrote:

> Within Forms I am currently trying to duplicate a record using: BEGIN
> ...
> CREATE_RECORD;
> DUPLICATE_RECORD; END;
>
> However, I'd like the records of the detail block to be duplicated as
> well. Example:
> Master Block is Invoice, Detail Block is Invoice_Lines, where
> Invoice is being duplicated but none of the 'Invoice_Lines' accompany
> the new record.
>
> Has anyone else been successful with this before?

Yes. Although, it takes some effort. The approach taken was to save the current detail record in the KEY-CREREC trigger of the master block before the CREATE_RECORD builtin is issued. This is done without knowing for certain that a [Duplicate Record] function will occur.

A generic solution is possible by dynamically creating a record group whose columns have the same names as the fields within the detail block. Then use the record group to populate the detail record after the [Create Record] and [Duplicate Record] occur. Put the generic solution in a PLL and you can use this solution in any similar form.

The assignment of these values causes the WHEN-VALIDATE-ITEM trigger to fire on each of the duplicated record's fields, assuming you have item-level validation selected. This is usually an advantage since FORMS does not otherwise fire these triggers under the assumption that the source record is valid therefore the values in the duplicate record are also valid.

Al

Al Lawson
Interactive Group, Inc.
www.interactive-group.com
lawsona_at_interactive-group.com Received on Fri Apr 25 1997 - 00:00:00 CEST

Original text of this message