Question : Savepoints, Rollbacks in forms

I issue an insert into statement and before comitting I issue a clear_block(no_validate) to cancel the transaction, but the insert statement is not rolled back.  When I issue a rollback the command will delete my headings(title, datetime, userid etc.) off of the form.  I have tried using a savepoint that I set just after I set up my headings on the form and isssue the rollback to savepoint, but it still does not seem to work.  Can I rollback my insert into statement without clearing out my complete form?

Answer : Savepoints, Rollbacks in forms

Dear Murphydp,

You are right !!! The userid and other fields are changed to null when you issue a rollback command in forms. This is because forms internally issues a clear form for this.

To solve you problem you should use the form built in's

ISSUE_SAVEPOINT(_name>);
ISSUE_ROLLBACK(name>);

Before entering the block mark a save point and issue a rollback when requires using the form builtin

Another work around to you problem is !!
based on certain condition the ON_INSERT trigger should fail
eg
  ON_INSERT trigger
 
  Begin
    If EVERYTHING_OK then
       INSERT_RECORD;
    Else
       NULL;
  End;

This way the record will not be inserted into the database and you even do not need to issue a rollback command

Hope this will solve your problems
Random Solutions  
 
programming4us programming4us