Shows the present first level Transaction mode of a variable based on a Business Component.
It only applies for reading purposes, to obtain the present first level mode of a Transaction executed as Business Component.
The default mode when you work with a Business Component variable, is Insert ('INS'). Then, suppose you assign values to the Business Component variable properties. Before applying the Save method the mode is Insert, but after saving, the mode changes to Update ('UPD') and the record keeps instantiated in memory.
In the case you apply the Load method to a Business Component variable in order to retrieve information from the database, the mode is set to Update and it keeps after invoking the Save method.
Is a variable defined in a GeneXus object, based on a Business Component.
The result returned by the method is a string that indicates the mode. The result can be assigned to a character variable or showed using Msg function as the following example shows, etc.
Suppose you define the Customer Transaction as Business Component (by setting its Business Component property = True):
CustomerId* (Autonumber property = True)
Accordingly, a Business Component data type of the Customer Transaction is automatically created in the Knowledge Base and you can define a variable of the new type created in any object. Thus, you can define a variable named &Customer based on the Customer type in any object.
The following code can be defined in that object, for example, for testing what the method provides. If the object is a Procedure, the code can be included in its source:
&Customer = new()
msg(&Customer.Mode()) //The mode is 'INS'
&Customer.CustomerName = 'Susan Brown'
&Customer.CustomerEmail = 'SBrown@mail.com'
msg(&Customer.Mode()) //The mode is 'UPD'
Business Components Methods