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


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.).


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"
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"
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


10.0NewNew in this version.