The return statement ends a subroutine.
The return statement may be used to end a subroutine at any point. When this statement is encountered Panorama stops the current procedure. If the current procedure was called as a subroutine by another procedure, Panorama returns to the previous procedure (hence the name of the statement). Panorama then continues from the point just after the call, farcall, shortcall or execute statement that started the procedure. If the current procedure was not called as a subroutine, it simply stops (see the stop statement).
Note: In previous versions of Panorama the return statement was called the rtn statement. You may use either or both of these spellings.
This example subroutine adjusts the inventory level if there is enough in stock to complete the order. Otherwise the subroutine simply returns to the original procedure that called it.
if OnHand < parameter(1)
Notice that this procedure does not have a return statement at the end. However, Panorama will always automatically return when it reaches the end of a procedure. You can include a return statement at the end if you like, but it is not necessary and makes no difference to the operation of the subroutine.
- call -- allows a procedure to call a separate procedure within the current database as a subroutine.
- call( -- allows a procedure to be called as a subroutine within a formula and return a result.
- callingdatabase( -- returns the name of the database that called this procedure as a subroutine, if any.
- callingprocedure( -- returns the name of the procedure that called this procedure as a subroutine, if any.
- callwithin --
- callwithin( -- allows a "mini-procedure" to be called as a subroutine within a formula and return a result.
- callwithindatabase( -- returns true if the current procedure was called by another procedure in the same database, false if it was called by a procedure in another database.
- execute -- allows a procedure to call a sequence of statements within the current procedure as a "mini-subroutine".
- execute( -- allows a formula to execute a sequence of statements and return a result.
- executeasap -- executes the specified code at the first possible opportunity, non-atomically.
- executecatcherrors -- is the same as the execute statement, except for the fact that if an error occurs while running it can be trapped by an if error statement immediately following the executecatcherrors statement.
- executelocal -- is the same as the execute statement, but it shares local variables with the procedure that called it.
- farcall -- allows a procedure to call a separate procedure within a different database as a subroutine.
- farcallwithin -- allows a procedure to call a mini-procedure within a separate procedure in a different database as a subroutine.
- getproceduretext( -- gets the contents (source code) of a procedure.
- info("parameters") -- returns the number of parameters passed to a subroutine.
- info("procedurestack") -- returns the contents of Panorama's procedure call stack.
- parameter( -- is used to transfer data between a main procedure and a subroutine.
- parameterentity( -- returns the entity (field or variable) associated with a subroutine parameter, if any.
- returnerror -- passes an error back to the current subroutines calling procedure.
- setparameter -- is used to transfer data from a subroutine back to the main
procedure that called it.
- shortcall -- allows a procedure to call a sequence of statements within the current procedure as a "mini-subroutine".
|10.0||No Change||Carried over from Panorama 6.0.|