help:how to commit before leaving record

From: <ollipekka.tarna_at_akermar.com>
Date: Fri, 24 Sep 1999 12:23:45 GMT
Message-ID: <7sfqg6$uq7$1_at_nnrp1.deja.com>



Hi Gurus, these triggers are driving me crazy!

I have a form where changed data should be committed before leaving the record. I have tried to achieve this with the aid of the post-record trigger that fails the trigger if record's status is 'CHANGED':

if :SYSTEM.RECORD_STATUS = 'CHANGED' then

    message('You must commit first');
    raise FORM_TRIGGER_FAILURE;
end if;

This doesn't seem to work! When I commit the form with Builder's menu command Action Save or with the accept-key F10 (I'm developing on a NT 4 Server with Forms 5.0 and Oracle 8.0.5) Forms doesn't do a commit - another post-record trigger fails it.

I have also tried to do the job by using a global flag: When the form starts the flag is initialized to 'N'. Then the flag is tested in the post-record trigger:

if :SYSTEM.RECORD_STATUS = 'CHANGED' then   if :GLOBAL.commit_flag = 'N' then
    message('You must commit first');
    raise FORM_TRIGGER_FAILURE;
  else
    :GLOBAL.commit_flag := 'N';
  end if;
end if;

The flag must me toggled somewhere. I have a commit button on my form that toggles the flag to 'Y' and runs built-ins Enter and Commit_Form. That way it works. But the user can try to commit the form by the means mentioned earlier (Action | Save or F10) and I think they should be able to do that. I tried to toggle the flag in pre- and post-commit triggers but it doesn't work.

How can I achieve my goal? There must be many gurus out there who can drop me a helping hand. I think this must be a fairly common functionality.

Any help will be appreciated.

OPT Sent via Deja.com http://www.deja.com/
Before you buy. Received on Fri Sep 24 1999 - 14:23:45 CEST

Original text of this message