Business Component RemoveByKey method

Official Content
This documentation is valid for:

Removes 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 RemoveByKey method can be used to remove the desired "line" by specifying the second level identifier.

Example

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 delete for the AttractionId = 6 the line whose AttractionTicketId=3, you can do so with the following code:

&Attraction.Load(6)
&Success = &Attraction.Ticket.RemoveByKey(3)    //&Success: Boolean
&Attraction.Save()
If &Attraction.Success()
   commit
else
   rollback
endif

Availability

This method is available since GeneXus 15.

For iOS offline 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 remove a header.