Adding a link object
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Often when you add to a association with a link class, you want do things with the created link object.

Do like this;

Association object.png

Add a method to either of the "main" classes with a content similar to this;

self.Flights.add(aFlight); 
self.Bookings->select(b | b.Flight = aFlight)->first

It adds the object at the other end to the association, and then looks up the created link object. In this case, a Booking object and returns it.

Please note that it's usually very good to set the names on the links, both the InnerLinkName and the LinkRoleName.

In this example, this is the InnerLinkName and the LinkRoleName for the Persons end of the association.

Linkrolename.png

Note! From the Booking object, it's only one Person object in the association. Hence, Person, not Persons

See also: Association classes

This page was edited 48 days ago on 02/10/2024. What links here