parameter(
parameter(
NUMBER
)

The parameter( function is used to transfer data between a main procedure and a subroutine.

Parameters

This function has one parameter:

number – is a number specifying what parameter you want to retrieve. All parameters are numbered, starting with 1 (1, 2, 3, 4, etc.).

Description

The parameter( function is used to transfer data between a main procedure and a subroutine. The main procedure can set up one or more data item parameters as part of the call statement (or one of the variations, including farcall, shortcall and execute. The subroutine can retrieve and use these data items using the parameter( function.

Here is a main procedure that calls the subroutine GetNumber with two parameters.

    local addCount
    addCount=1
    call GetNumber,"Add how many records?",addCount
    loopwhile addCount>0
        addrecord
        addCount=addCount-1
     endloop

Now let’s look at the GetNumber subroutine, which retrieves these two parameters with the parameter( function.

    local temptext
    temptext=str(parameter(2))
    gettext parameter(1),temptext
    setparameter 2,val(temptext)

Error Messages

parameter( function must be used within a procedure. – You’ll see this error message if you try to use the parameter( function anywhere but in a procedure (for example in a form object).

parameter( function: Current procedure was not called as a subroutine. – This means that you are trying to use the parameter( function in your main procedure. It should only be used in a subroutine.

Parameter does not exist – The requested parameter was not supplied by the calling procedure.

See Also

- 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.
- calledby( -- returns true if this function is in code called by the specified database, the specified procedure, or both.
- 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 -- allows a procedure to call a mini-procedure within a separate procedure within the current database as a subroutine.
- 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.
- parameterentity( -- returns the entity (field or variable) associated with a subroutine parameter, if any.
- return -- ends a subroutine.
- 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".

History

Version | Status | Notes
10.0 | No Change | Carried over from Panorama 6.0