Re: Which trigger do i use??

From: Steve Cosner <stevec_at_zimmer.csufresno.edu>
Date: 1998/04/02
Message-ID: <6fvck9$c8d1_at_hendrix.csufresno.edu>#1/1


In article <35215EEE.AEB971D9_at_csc.com>, Savithri Devaraj <sdevaraj_at_csc.com> wrote:

> We use Dev2000 Forms 4.5 for a project here. When i have entered
> all the data on the form, if I donot save them and try to navigate
> to another form using a Menu - I get a forms message " Do you want
> to save your changes?" In which trigger can i intercept this
> message?
>
> I have a lot of commit processing that needs to be done before the
> data can be saved to the database. But when this message comes, and
> the user picks "yes", it bypasses all integrity checking and saves
> the data to the database. I want to force the integrity checking
> before the data can be saved. I have so far tried
>
> On-commit
> post-forms-commit
> key-exit
> on-close
> On-message, etc.
> Either they are too late or they donot fire for this event. Any Dev
> 2000 gurus out there who have a clue??
>
> Thanks a lot in advance for your suggestions
> Savithri

That is one of several messages that you cannot trap anywhere. (Oracle should do something about that.) But you can do this: If your :system.Form_Status = 'CHANGED' then do a Clear_For(no_commit,full_rollback). This will discard any changes prior to leaving the form, and the form will not pop the question.

Before we discovered the above method, we did the folowing: If the user clicks the correct "save" button, or uses the standard key-commit, we call a procedure that does all of the integrity and business-rule edits required before the commit. Then (here's the trick), we set a flag immediately before the Commit_Form command, and un-set the flag afterwards.

In the pre-commit trigger we check this flag. Since it has been set by OUR process, it allows the commit to proceed. If the user answers "yes" to the "Do you want to save your changes" question, the pre-commit trigger finds the commit_flag not set, and issues a message, "You must use the Commit Key to save your changes.", and raises Form_Trigger_Failure, preventing the commit, and preventing the exit_form.

Hope this helps,
Steve Cosner
http://members.aol.com/stevec5088 Received on Thu Apr 02 1998 - 00:00:00 CEST

Original text of this message