FAQ's - APPX Software, Inc. : APPX Utility : APPX Development Environment : Tips & Techniques :
How does LOCAL and RECEIVE statements work?
|First: a LOCAL statement is (nearly) equivalent to a RECEIVE statement that executes without a matching PASS statement (the RECEIVE statement will set the next T/F to F, but a LOCAL statement doesn't change the T/F flags). |
Second: when you execute a LOCAL (or RECEIVE) statement, the engine has to decide the point in time that the original value should be restored.
If you execute a LOCAL (or RECEIVE) while there is a GOSUB active (in the current event point), the original value is restored when you execute a RETURN statement.
If there is no GOSUB active, the original value is restored when the event point ends (with one exception). That means that you can add LOCAL statements to the beginning of an event point to protect variables that you want to use in that event point. You could instead add a RECEIVE statement, but that would be kind of weird (that may let you PASS a value in one event point and RECEIVE it in the next event point, but I can't recommend doing that).
If you execute a LOCAL statement (and there is no active GOSUB) in the StartOfProcess event point, you are protecting a variable for the life of the process (the original value is restored when the process ends).
|[Append to This Answer]|
|Previous:||Can Current Release of Appx support LDAP?|
|Next:||Can i have environment variable APPX_41_EPS set while designing in 4.2?|