Re: How to use sequences, and which trgger for "Execute_Querry'?
Date: Tue, 3 Oct 2000 20:01:07 -0700
Message-ID: <stl735btna9f36_at_corp.supernews.com>
[Quoted] "Richard Hollingsworth" <william.hollingsworth_at_hsv.boeing.com> wrote in message
news:39D9FC2B.8EAF6817_at_hsv.boeing.com...
> Hi. Thanks for reading this.
>
> I have a sequence defined, and want it to increment by 1 each time I add
> a new record. Well, what happens is, when the form comes up, no records
> are visible. I have to manually press the 'execute_querry' button to
> get the old records to show up.
Standard functionality.
>When I do that, the records appear, but
> the sequence number has now doubled. Also, each time I press the "next"
> or "previous" record button to review the old records, the sequence
> increments.
That's because you have it in WHEN-NEW-RECORD-INSTANCE. As you land on another record, it fires.
> So I think I have the "select cr_seq.nextval into
> :change_request.cr_number from dual;" statement on the wrong trigger.
> Which one should it be on? I have it on the "WHEN-NEW-RECORD-INSTANCE"
> trigger for the block. I also tried the "WHEN-NEW-BLOCK-INSTANCE"
> TRIGGER. Same results.
Depends on when you want to do it - can you be more specific? Do you want it [Quoted] [Quoted] for every record you commit to the database? Try POST-INSERT then. Do you [Quoted] [Quoted] want it for every record you enter even if you don't commit them? Then do it [Quoted] [Quoted] on WHEN-NEW-RECORD-INSTANCE with a "IF :SYSTEM.RECORD_STATUS = 'NEW'" condition [Quoted] [Quoted] around it. Or when you leave a record and go to another one? Try POST-RECORD [Quoted] or WHEN-VALIDATE-RECORD (depending on what you want) with a "IF [Quoted] :SYSTEM.RECORD_STATUS = 'INSERT'" condition.
Any other way you want to do it?
> Also, where does the "EXECUTE_QUERRY" command go so it will auto. load
> the old records for the table when the form appears?
WHEN-NEW-FORM-INSTANCE is a good place if your first navigable block is the one [Quoted] [Quoted] you want. Otherwise, preface it with a go_block(<blockname>); first before you [Quoted] execute the query.
-Matt Received on Wed Oct 04 2000 - 05:01:07 CEST