parameterentity(
parameterentity(
NUMBER
)

The parameterentity( function returns the entity (field or variable) associated with a subroutine parameter, if any.

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

This function returns the field or variable name associated with a parameter passed to the current subroutine. If there is no field or variable associated with the parameter (for example if the parameter is a constant or a complex expression) then this function returns empty text (“”).

This rather contrived subroutine calculates a date a week in the future and assigns it to the field or variable specified by the first parameter of the subroutine. It uses parameterentity( to verify that parameter 1 is a field or variable, and then checks to see if the destination is a field, and if so, what type of field. If it is a text field it converts the date to text, if it is a numeric field it generates an error. All of this logic is based on the field or variable name returned by the parameterentity( function.

    let futureDate = today()+7
    let targetEntity = parameterentity(1)
    if targetEntity=""
        rtnerror "Parameter 1 must be a field or variable"
    endif
    if fieldnumber("",targetEntity+"")>0
        // parameter is a field, but what type?
        let targetFieldType = grabfieldtype("",targetEntity+"")
        if targetFieldType=0
            futureDate = datepattern(futureDate,"mm/dd/yy") // text field
        elseif targetFieldType <> 4
            rtnerror "Parameter 1 must be a text or date field"
        endif
    endif
    setparameter 1,futureDate

Notice in the code above that `+""` is concatenated to the `targetEntity` variable within the fieldnumber( function. Without this, the fieldnumber( function would think that you wanted the function to figure out the field number of targetEntity, when the field name is actually whatever is inside the targetEntity variable.

Error Messages

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

parameterentity( function: Current procedure was not called as a subroutine. – This means that you are trying to use the parameterentity( 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.
- Custom Statements -- creating your own custom statements that can be used in your code.
- 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.
- 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 | New | New in this version.