Calls a GeneXus object (either with transfer of parameters or not) such as a Web Panel or a Procedure, etc., from another object (which is the caller).
ObjectName.Call([parm1, .... , parN])
Is the name of the object you want to call.
par1, …, parN
Are optional parameters that can be sent to the called object with some purpose (and they must be received in the called object by declaring them with the Parm rule).
Objects: Procedure, Transaction, Web Panel, Panel
The Call method can be written in different sections of the caller object, depending on whether the caller is a Transaction, a Web Panel, a Procedure, etc. (if the caller is a Procedure, the Call method must be included in some line of its Source; if the caller object is a Transaction, the call can be included in its Rules section as well as inside an Event, depending on the requirement, etc.).
Note: The syntax of the Call method allows you to omit the dot and the Call, and the invocation will be exactly the same, as GeneXus has the intelligence to detect that you are calling an object.
Suppose you have a Web Panel in your Knowledge Base, that only has a button included in its form. When the user presses the button, the event associated with the button is executed and the objective is to call a Procedure that prints all the customers. So, you define the following code inside the event associated with the button, to achieve the objective:
Event 'Print all customers'
The following code behaves exactly like the above:
Event 'Print all customers'
PrintAllCustomers() //the dot and the call were omited
In both examples, the Procedure named PrintAllCustomers is called without parameters (so, no Parm rule is needed to be defined in the Procedure).
Now suppose the Web Panel has a Dynamic Combo Box in its form, that shows all the countries stored in the database. And the button is also present in the form. The user will select a country and after that, he will press the button. The objective in this case, is to call a Procedure that prints all the customers who belong to the country selected by the user.
When the user selects a country, the CountryId attribute value will be assigned to the &CountryId variable associated with the Dynamic Combo Box. After that, when the user presses the button, the event associated with the button will be executed.
So, inside the event associated with the button, you have to define the invocation to the Procedure. In this case, you have to send to the Procedure the &CountryId variable as a parameter. The Procedure will receive the parameter (you must declare the parameter in the Procedure with the Parm rule); finally, you will use the received value in the Procedure, in order to filter the customers that belong to that country.
The following code inside the event associated with the button, is calling the Procedure named PrintCustomers, and the &CountryId variable is sent to it as a parameter:
Event 'Print customers'
The Procedure must have defined the following rule:
and the &CountryId variable is used in the Procedure source in order to filter the customers that belong to that country, like the following code shows:
Communication between objects