Re: Forms 4.5 - Move to a record

From: Marcel Claus <Marcel.Claus_at_Informatik.Uni-Oldenburg.DE>
Date: Tue, 26 May 1998 11:01:34 +0100
Message-ID: <6ke0cd$srv_at_news.Informatik.Uni-Oldenburg.DE>


Giovanni Catemario wrote:

> Hello,
>
> i'am using Forms 4.5
>
> i have a form with one master block (name,surname,id etc.) and a
> detail block. I also have on my form a toolbarwith buttons to move
> next record o prev record.
>
> When i open the form the first time all the record are selected so i
> can move next and prev record using the toolbar on the form. Let's say
> that the record are ordered alphabetically.
>
> The problem is that my customer have to insert, every month, a lot of
> record in the detail block. He start from A (in the master block)
> insert record in the detail block, then next record (in the master
> block) ... and so on.
>
> What the customer want is to move directly to record (let say 'SMITH')
> without perform a query, so they can press the next record key (or
> prev record) on the toollbar and go to the next record ... and so on.
>
> I was not able to find any way to go to a certain record inside a
> query so i can use previous_record and next_record to scroll the table
> up and down.
>
> Any suggestion ??
>
> By
>
> Giovanni Catemario (Rome, Italy)

  You can solve the problem with some PL/SQL-statements.

1) GO_BLOCK('the_blk');
2) Make sure you have an ORDER-BY specified in the BLOCK-PROPERTIE-SHEET
3) Get the whole table-data from the database with
EXECUTE_QUERY('ALL_RECORDS');
4) Move to the first record: FIRST_RECORD; 5) Loop through the data to find the entrie:

stop := FALSE;
WHILE NOT stop LOOP
  stop := :the_blk.the_col = 'the_data';   IF NOT stop THEN
    NEXT_RECORD;
    stop := :the_blk.the_col IS NULL; -- this is quick and dirty: you should check for block-status = new_rec
  END IF;
END LOOP;
IF NOT stop THEN

   here comes an error-message: data not found;   DELETE_RECORD;
ELSE
  do whatever should be done when you had success END IF; Marcel Received on Tue May 26 1998 - 12:01:34 CEST

Original text of this message