This method can be applied to a variable based on a business component type of a Transaction, in order to convert the data stored in it, to an XML structure with a Tag for each transaction attribute.
Besides, for each Transaction attribute a Tag_Z will be created with its old value.
&StringVble = &VbleBasedOnBCType.ToXml()
Is a -temporary and local- variable defined in a GeneXus object, based on the character type.
Is a -temporary and local- variable defined in a GeneXus object, based on a business component type of a Transaction.
Suppose you define the following 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 KB and you are able to define in any object, a variable of the new type created.
Thus, in a web panel you define a variable named &customer based on the Customer type.
The objective of the web panel is to allow the user to enter a customer Id value. Then, by pressing a button, the event associated to the button will load in memory (in the &customer business component variable) the customer data stored in the database associated to the customer id entered by the user. Next, the ToXml method will be applied to the &customer variable, in order to convert the customer data to an XML format and it will be shown in the web panel form.
To achieve this, you will have to define in the web panel also these variables:
&CustomerId: Based on CustomerId attribute
and design the web panel form like this:
The following code is associated to the web panel button:
In run-time, suppose the user enters in the &CustomerId variable the value: 9. Then he press the button, and the customer data is loaded in the &customer variable and converted to xml format, like the following image shows:
Business Components Methods