Business Component GetByKey method

Official Content
This documentation is valid for:

This method can be applied to a variable based on a Business Component type of a two-level transaction, in order to get a record that corresponds to a "line" by specifying its key.

First, all the structure must be loaded in memory by using the Load method, and after that, the GetByKey method can be used to get the desired "line" by specifying the second level identifier.

Suppose you define the following two-level transaction as a Business component (by setting its Business component property = True):

Attraction2LevelsTrn

If you need to update for the AttractionId = 6 its AttractionTicketId=3 with a different price, you can do so with the following code:

&Attraction.Load(6)
&AttractionTicket = &Attraction.Ticket.GetByKey(3)
&AttractionTicket.AttractionTicketPrice = 100
&Attraction.Save()
If &Attraction.Success()
   Commit
else
   Rollback
endif

Availability

This method is available since GeneXus 15.

Note: For iOS offline is available as from GeneXus 15 Upgrade 2.

Note

This method also applies to a collection of "headers". That is to say, it applies to a collection of business components in order to get a header.


Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.