Custom Sorting with Associations

For an entity I have defined some MetaProperties that I use kind of as alternate instance names for different situations. I’m attempting to define custom sorting for these different MetaProperties but I’m running into an issue of how to define the sorting for associated entities.

I see in the docs that I can use the {E} alias to reference the current MetaClass, but I’m unsure how to reference the associated classes.

As an illustration, I have a Visit entity that is associated with a Pet and a Vet, as well as a visitDate. If I have a MetaProperty petNameVetNameVisitDate that merges the Pet/Vet/visitDate values, I would like to sort visits first on the associated pet and then the associated vet and then the visitDate. Any guidance on how to implement this?

As I understand, the example described in documentation may be useful for you:

With the paramWhere clause, you can introduce dependencies between parameters. For example, let’s assume that Manufacturer is a separate entity. That is Car has a reference to Model which in turn has a reference to Manufacturer . Then you may want to create two conditions for the Cars filter: first to select a Manufacturer and second to select a Model.

I’m looking for an implementation of this section in the docs but with the above described associations.