Official Content

Gets a record that corresponds to a "line" of a variable based on a Business Component type of a two-level Transaction object by specifying its key.

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

If this method doesn't find a line with the required key, it returns a new, empty Business Component instance.

Samples

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

Attraction
{
   AttractionId*
   AttractionName
   CategoryId
   CategoryName
   CountryId
   CountryName
   CityId
   CityName

   Ticket
   {
      AttractionTicketId*
      AttractionTicketDescription
      AttractionTicketPrice
   }
}

If you need to update for the AttractionId = 6 its AttractionTicketId=3 with a different price, you can do so by defining this code for example in the Source of a Procedure or in the Events of an object:

&Attraction.Load(6)
&AttractionTicket = &Attraction.Ticket.GetByKey(3)
if not &AttractionTicket.IsEmpty()
   &AttractionTicket.AttractionTicketPrice = 100
   &Attraction.Save()
   If &Attraction.Success()
      commit
   else
      rollback
   endif
endif

Variables:

&Attraction: based on BC Attraction. 
&AttractionTicket: based on BC  Attraction.Ticket.

Availability

This method is available since GeneXus 15.

For  Apple is available since 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.



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