This documentation has no mention of sorting the elements
Asked
Active
Viewed 49 times
0
-
Ex if objects are cars that have the following properties, color, make, model. I want to print out a list of objects ordered by color, – user6284097 Sep 16 '16 at 23:12
-
1. Please provide class definitions. 2. %Library.RelationshipObject is not used directly 3. How do you access the data? Via objects? Please edit your question to address these points. – rfg Sep 17 '16 at 08:12
1 Answers
0
As an example I'll show sql query by class Sample.Employee in SAMPLES namespace, where properties Spouse and Company are relationships. You may get access to related object via ->
and you can order by alias.
SELECT
title,
Spouse->Name,
Company->Name as CompanyName
FROM
sample.employee
ORDER BY
CompanyName

DAiMor
- 3,185
- 16
- 24
-
Thanks DAiMor. But that objects I am dealing with do not have a %Id, so I do not know how to get them using a sql statement. – user6284097 Sep 17 '16 at 13:48
-
Why do you think so, why do you think it is so matter? Every table in Caché by default has %ID property. – DAiMor Sep 17 '16 at 15:25
-
When I do "write object.%Id()", where object is the classname of the child or the parent, on the terminal nothing is returned. %Id would are needed in the select statement to make sure I am selecting the rows of child objects that belong to the parent object. – user6284097 Sep 18 '16 at 13:32
-
Just update you question with simple example of you classes, parent and child. It helps to understand your problem. – DAiMor Sep 19 '16 at 11:45