Thursday, July 21, 2011

StopAction()

An old favorite in v9, this allowed for halting action expressions, including returning a value when stated criteria was met.

The help file uses it in relation to a Confirm function, which is nice.  I typically use it with those, and custom forms to act like a return keyword in most languages since it could return a value as well.

So you could call a StopAction(My Value) and halt a flow of logic and return a value.  Useful in a lot of situations. 

Everything is good with examples so let's look at one:


arrGotOne := SqlExecute("Select ORIGREC from HDHISTORY where MBNO = ?strMBNO?");

:IF len(arrGotOne) > 0;
    UsrMes("Can not Delete","This MB Number has been used.  We can not delete it from the list.  Retire it");
    stopaction();  
:ELSE;
    SqlExecute("Delete from HDDRIVES where ORIGREC = ?intORIGREC?");
:ENDIF;


No comments:

Post a Comment