Re: Unique Check for Forms 6 Data Block

From: Al Ruiz <arruiz_at_flash.net>
Date: 2000/04/22
Message-ID: <39021CF6.8C09628A_at_flash.net>#1/1


I would just use thw when-record-validated trigger to POST the data in the block and let the system reject the duplicates by using an execption handler...

Al

schroeerm_at_my-deja.com wrote:

> In article <8ck1ln$734$1_at_mawar.singnet.com.sg>,
> "William" <sucheeha_at_singnet.com.sg> wrote:
> > Currently my data block is displaying multiple records and my
 application
> > requires that we allow the user to input multiple records. All the
 records
> > are still buffered in the Forms and not Posted to the database, so
 even if I
> > issue a query against the database I won't find any.(am I right?)
> >
> > e.g.
> > Item_Code Brand_Code
> > line 1 0-10 NTN
> > line 2 0-12 NTN
> > line 3 0-10 NTN -----> how to detect this
> > duplicate entry
> >
> > Thanks a lot!
> >
> >
> Hi William,
>
> If it is possible to do a commit when navigating to next row, you can
> do so by building a key-down trigger with following plsql-code
> commit; -- or do_key('commit_form');
> down; -- or do_key('down')
>
> If it is not possible to do a commit you have to go through your rows
> and check the primary key values in the when-validate-item trigger
> e.g:
> declare
> cur_rec number;
> cur_primary_key varchar2;
> i number;
> pragma exception_init (duplicate_key, -20000);
> begin
> currec:=:system.trigger_record;
> cur_primary_key:=:block_name.primary_key_column;
> i:=1
> go_record(1);
> while i < currec loop
> if :block_name.primary_key_column = cur_primary_key then
> raise duplicate_key;
> end if;
> next_record;
> end loop;
> exception
> when duplicate_key then
> go_record(currec);
> message('duplicate key´');
> end;
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Sat Apr 22 2000 - 00:00:00 CEST

Original text of this message