OnModify trigger

I want to say something like this in my Onmodify() trigger :

IF CONFIRM (TEXT001,FALSE) THEN

MESSAGE(TEXT002);

Else

Exist; // here I mean exit without changing

Which means change the Rec plz only if the user confirms! other wise exit without changing anything.

Is this the right way, coz even if the user didnot confirms it changes the rec in my table.

I would say:

IF NOT CONFIRM(Text001,FALSE) THEN
EXIT;

MESSAGE(Text002);

Just to follow the best patterns.

you can use your code.

IF CONFIRM (TEXT001,FALSE) THEN

MESSAGE(TEXT002); // here in that case use no semicolon

ELSE

Exist; // EXIT;

if you want to write more lines between THEN and ELSE, then you should write

… THEN BEGIN

// modify records

END ELSE …

or you follow the suggestion of erik.

EXIT will simply stop executing the OnModify trigger but wont stop modification to record.

You need to use ERROR(‘’); instead of EXIT

You’re right Mohana! My mistake!

IF NOT CONFIRM(Text001,FALSE) THEN
ERROR(Text005);

Text = 'You aborted the modifications".

But on the other hand then I do find that doing this in the first place is going down the wrong alley. Firstly need to add GUIALLOWED in case it’s ever run through something else than pages.

The next problem is that when coming up with the message, then it’s not always clear to the user which of the changes are cancelled when getting the CONFIRM prompt.

additional:

better not use onmodify trigger, but the field-onvalidate triggers. then you can use your code, no need for the error message, except you want it.