Re: forms problem

From: Marcel Claus <Marcel.Claus_at_Informatik.Uni-Oldenburg.DE>
Date: Tue, 26 May 1998 10:52:29 +0100
Message-ID: <6kdvrc$srv_at_news.Informatik.Uni-Oldenburg.DE>


Martin Meadows wrote:

> I'm working with 2 blocks on 2 separate screens (pages). Screen 2 is a
> pop-up that comes up when a certain field on screen 1 is crossed. The
> base table for each screen is different. When screen 2 pops up,
> the user enters data in 2 columns (job function & billable hours). When
> the user hits the commit key I jump back to the first screen, post the
> entries from the user & sum them with a select statement. The result
> goes in the field I jumped on screen 1.
>
> Here's the problem: if I use a query to bring up screen 1 & 2 and then
> modify screen 2 hours, when I go back to screen 1 I get the following
> error message:
>
> FRM-40654: record changed by another user. requery to see change.
>
> Why am I getting this error message? There are no other users.
>
> Thanks,
> Martin Meadows

I don't understand the way your app works, but I think it works and I also think I know the problem.
Forms works - lets say - off-line. This means you fetch the data from the DB and store it in RAM on the client. When you modify it changes are not directly sent to the DB. The moment you send the commit or DO_KEY('Commit_Form') changes are processed. But first Forms checks for changes made by other users regardless if it were really other users or even the application doing the commit. I think that you somehow modify some columns in the database and do not tell it all the blocks in your forms-app dealing with data from these columns. Now you can do the following:

  1. When changing any data in the database via update or insert post a commit and refill the blocks in your form with the following statements:

GO_BLOCK('the_blk');
CLEAR_BLOCK('the_blk', no_validate);
EXECUTE_QUERY(all_records);
GO_BLOCK('block_from_where_you_came');

2) You can also write a ON-ERROR trigger   checking for the FRM-40654 and dealing with it:

declare
  err NUMBER := ERROR_CODE;
  errtxt VARCHAR2(120) := ERROR_TEXT;
  errtyp VARCHAR2(10) := ERROR_TYPE;
begin
  IF err = 40654 THEN
    :VARS.FETCH_ITEM := :SYSTEM.CURSOR_ITEM;     :VARS.FETCH_BLOCK := :SYSTEM.CURSOR_BLOCK;     GO_BLOCK(:VARS.FETCH_BLOCK);
    CLEAR_BLOCK(NO_VALIDATE);
    EXECUTE_QUERY(ALL_RECORDS);
  ELSE
    Message(errtyp||'-'||TO_CHAR(err)||': '||errtxt);     RAISE Form_Trigger_Failure;
  END IF;
end;

This does only work when the block producing the error is also the :SYSTEM.CURSOR_BLOCK

Marcel Received on Tue May 26 1998 - 11:52:29 CEST

Original text of this message