Re: Best point to commit in a Master/Dtl Form
Date: 1997/03/13
Message-ID: <19970313023201.VAA06593_at_ladder01.news.aol.com>#1/1
malh1156_at_aol.com (Malh1156) wrote:
> Hi,
> I am trying to ascertain when should I commit a record in a
> Master/Detail Form. 1) I can commit the master block as I navigate to
> the detail block, and subsequently
> commit each detail row as I navigate to the next row. OR
> 2) wait till the operator is done and then commit all records then
> when he presses save button. which one is better?
> If I implement 1), it is easy to check for duplicate records entered
> in the detail block as user enters them.
> But giving an explicit SAVE button to could be tricky.
>
> If I implement 2) then I am not sure If I can detect for duplicate
> records entered into the detail block till the operator TRIES to
> commit..
>
> I think I am missing something. Thanks in advance, Rajiv
>
I suggest letting the user commit. You can create a unique index to prevent the commit of duplicate records. If you are concerned about usability and would rather detect this at creation, define WHEN-VALIDATE-ITEM or WHEN-VALIDATE-RECORD triggers on the detail block. Make sure your validation_unit form property is set to ITEM or RECORD, respectively. These triggers should fire when the "leave the item" or "leave the record" event occurs. In the validation trigger you can do a select statement to find a matching record when record status is NEW or INSERT.
Watch out for the [Duplicate Record] function. FORMS copies the previous record to the new record and does not fire ANY validation triggers because it assumes the data is already valid. You need to define a KEY-DUPREC trigger to spoil the key fields to force the validation. Spoil a field by assigning the field to itself or set the ITEM_IS_VALID item property to FALSE. Hope this helps.
Al Lawson
Interactive Group, Inc.
www.interactive-group.com
lawsona_at_interactive-group.com
Received on Thu Mar 13 1997 - 00:00:00 CET
