Re: Forms4.5 help request

From: Steve Cosner <stevec_at_zimmer.csufresno.edu>
Date: 1997/01/24
Message-ID: <5cbfih$qhr_at_shadow.CSUFresno.EDU>#1/1


In article <01bc0a37$3959d980$LocalHost_at_michaelb>, Michael Burnham <mburnham_at_globaldialog.com> wrote:

> I have a master-detail form. When a master record is created, I
> need to create a set of detail records automatically. (The detail
> records gather user-defined information about the master record.
> The users define the list of records that are tagged to each master
> elsewhere in the application.) There is a table that holds the
> "templates" of the detail records that need to be dynamically
> created when the master record is created.
>
> I have tried the following approach: I am using a trigger (tied to a
> validate action) on the master record that issues an "insert into
> the [detail_table] select [whatever] from [detail_template_records]
> where...". I then go_block to the detail block and query the
> records that were added >behind the scenes. However, since forms
> didn't directly alter the records, I need to trick it into wanting
> to commit the records.
>
> I know that I could use the server to add the detail records on a
> commit trigger, but I don't want to do an intermediate commit during
> the processing of the form -- since the master could be rolled back.

The easiest way would be:
  In a post-query trigger on your detail block, set Record_Status to   Changed.

However, if I were doing the form, I would do it a little differently:   Rather than insert into the [detail_table], write a cursor loop to   query the template records, and fetch them into the rows in the   detail block. The form would automatically set the new rows as   status=insert. These would be ready for the user to enter   additional data or change template data, etc. before any database   table is modified. Then when the commit is done, everything is   completed.

Using your first method, there may be a scenario where the rows you insert behind the scenes get committed inadvertently unless you are extremely careful to rollback everything if the user doesn't commit the rows you display. For example, a clear block leaves the rows posted, I believe, rather than doing a rollback as you might assume.

HTH,
Steve Cosner Received on Fri Jan 24 1997 - 00:00:00 CET

Original text of this message