An attribute can be a 'subtype' of another, meaning that the first attribute is just the second attribute with another name.
Subtypes must be defined in 'Groups'. For example, given the Airport Transaction object:
The subtypes of AirportId and AirportName must be defined in a group as follows:
|DepartureAirport Subtype Group
|DepartureAirportId is a subtype of AirportId
|DepartureAirportName is a subtype of AirportName
A Group can be viewed as a 'virtual' transaction in the sense that even if the Subtype Group definition doesn't indicate GeneXus by itself that a table must be created to store departure airports, it has all the other properties of a Transaction (a Group key, a Base Table, etc.).
We say that DepartureAirportId is a subtype attribute and AirportId is its supertype attribute. In the same way, the DepartureAirportName attribute is a subtype and AirportName is its supertype. A well-defined Subtype Group must contain a subtype attribute or a set of subtype attributes, whose corresponding supertype attributes make up the primary key of an existing physical table. In the above example, there is a physical table whose primary key is AirportId: the AIRPORT table (and that physical table is the Base Table of the Group).
The Subtype Group definition allows:
- Subtypes of supertypes that belong to the base table of the Group.
- Subtypes of supertypes that belong to the Extended Table of the base table of the Group.
- Formula attributes can be used in the group definition, with the exception of formulas that use UDP calls.
To include inferred subtypes from the extended table of the base table of the Subtype Group in it, it is necessary to define in the Group a subtype of the foreign key through which they are inferred.
When to use Subtypes
What are Subtypes?