Re: ASK FOR COMMIT BEFORE LEAVING A RECORD INSTANCE.

From: Yann Chevriaux <chevriaux_at_theleme.com>
Date: Mon, 27 Sep 1999 15:02:20 +0200
Message-ID: <37EF6ADC.2D0DAE71_at_theleme.com>


Sorry, I didn't test what I've posted ....

Maybe using WHEN-NEW-RECORD-INSTANCE and a variable to store the position to go back if user choose NO COMMIT:

POST-RECORD trigger:


  • Set a flag if :system.record_status in ('CHANGED','INSERT') then :global.before_commit_position:= :system.cursor_item; else :global.before_commit_position := null; end if;

WHEN-NEW-RECORD-INSTANCE trigger


  • Test the flag and if asked : commit ! if :system.mode='NORMAL' then /* Don't fire in ENTER_QUERY or EXECUTE_QUERY modes */ if :variables.before_commit_position is not null then answer:=Show_Alert(...); if answer=ALERT_BUTTON2 then /* button1 is (YES) and button 2 is (NO) */ Go_Item(:global.before_commit_position); raise form_trigger_failure; end if; end if; end if;

Does it work better ?

  Yann.

"Olivier Régis" a écrit :

> YANN,
>
> MY PROBLEM IS THAT I MUST COMMIT IN THE ANSWER IS YES.
>
> HERE'S IS MY CURRENT POST-RECORD TRIGGER AT FORM LEVEL:
> COMMIT DOESN'T WORK IN THIS TRIGGER...
> I WANT A COMMIT SUCCESSFULL EVERYTIME THE USER PRESS "YES" AND EVERYTIME
> THERE'S CHANGE IN A RECORD.. AND WHEN NAVIGATING TO ANOTHER RECORD OF EVERY
> BLOCKS..
>
> HAVE YOU A SOLUTION TO RESOLVE THE "COMMIT".. ??
>
> THANKS
>
> OLIVIER
>
> -------
>
> declare
> answer number;
> begin
> if :system.form_status != 'QUERY' then
> if :system.record_status in ('CHANGED','INSERT')
> then
> SET_ALERT_PROPERTY ('ALERT_YES_NO',ALERT_MESSAGE_TEXT,'COMMIT CHANGES ?');
> answer := show_alert('Alert_yes_no');
> if answer = ALERT_BUTTON2 then
> raise form_trigger_failure;
> end if;
>
> --Enter; -- force the validation to happen first
> -- if not form_success then
> -- bell;
> -- my_show_alert_caution(null,'Validation failed');
> -- raise form_trigger_failure;
> -- end if;
> commit;
> --DO_KEY('COMMIT_FORM');
> bell;
> --if :system.form_status <> 'QUERY' then
> --bell;
> --my_show_alert_caution(null,'An error prevented your changes from
> being commited.');
> --raise form_trigger_failure;
> -- end if;
> end if;
> end if;
> end;
Received on Mon Sep 27 1999 - 15:02:20 CEST

Original text of this message