Table of contents



Official Content

Declares the list of parameters that a GeneXus object receives from the object(s) which invoke(s) it. 

Syntax

Parm([in:|out:|inout:]parm1, …, [in:|out:|inout:] parmN);

Where:

in: | out: | inout: 
    Are operators which allow defining for each parameter, how it is going to be used in the called object (in, out, inout).

parm1, ..., parmN:
   Are variables or attributes that are defined in the called object. For each parameter received, you can decide whether you declare it as an attribute or a variable, regardless of how it was sent.

Description

When an object is called from another object with parameters, the set of parameters received must be declared inside the Parm rule in the called object, respecting the order and the data type as they were sent, each one separated by a comma. In addition to this, for each parameter it is optional to point out how it is going to be used (in, out, inout).

If the object was invoked with Call, and N parameters were transferred, the N parameters must be declared in the parm rule. However, if the object was invoked with the Udp method and unless it was invoked in a Data Provider), bear in mind the following:

  • N + 1 parameters must be declared in the parm rule of the called object.
  • The last parameter declared in the parm rule corresponds to the value which is returned (in other words, corresponds to the value received in the caller object).
  • A value must be assigned to the returned (the last) parameter somewhere in the called object.
     

Considerations:

  • As they receive parameters and they must be called with the parameters' values, none of the objects that have a Parm rule defined are included in the Developer Menu.
  • Parameters do not receive a null value. If a null value is sent in a parameter, the called program receives an empty value.
  • Variables that are in a Parm rule are set as read-only by default when they are put in a form of a Web Panel object or Transaction object.


The difference between using a variable on an at or an attribute in the Parm rule of the invoked object lies in the fact that If you receive the value in a variable, it may be used freely in programming, as a filter condition for equality (higher than, greater than or equal to, lesser than, lesser than or equal to), for some arithmetical operations, or whatever you may need to do with it. On the other hand, if you receive the value in an attribute, it will automatically act as a filter for equality in the object.

If your objective is not to use a value received to filter for equality, then the only solution possible is to receive the values in variables to use them freely.


Samples

The following codes, show two ways of filtering for equality the same information. The result and performance of both solutions are equal.

ParmAttributeOrVariable


Example 1

Suppose you define a Web Panel for the user to enter a start and end range of names of attractions to be listed. 

WebPanelEnterAttractionNamesRange

As the image shows, two variables and a button are present in the Web Panel form (the default Caption -Confirm- and the default event -Enter- are kept for the button). In the Enter event associated with the button, you have to call the Procedure object that prints the attractions that their names are included in the range indicated by the user.

The Procedure will receive the start and end range of names of attractions, and you have to use the range received to filter the requested attractions.

This is the invocation defined in the Web Panel:

InvokationImageForParmArticle

And this is the Parm rule declared in the Procedure:

ImageForParmArticle2

Note that the variables are named differently regarding the names defined in the Web Panel. What it is important is that the data types sent and received match.

The variables you receive in the Procedure will be used to filter the requested attractions. The following image shows the Procedure Source section, with the code that solves the requirement and using the received variables to filter:

ImageForParmArticle

Note: This Procedure has the necessary properties and rules to print the output in a PDF format.

Example 2 

See the proposed examples in the following articles:

Call method

Udp method


Related specification messages

  • spc0068 when a parameter has a data type that cannot be used for parameters in certain circunstances.
  • spc0023 for each parameter in the call command having a data type that is not compatible with the correspondig in the parm rule
  • spc0024 if there are too few parameters in the call command
  • spc0025 if there are too many parameters in the call command





Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant