Search code examples
objectscript

Is there a way to retrieve objects of a %Library.RelationshipObject by a certain order


This documentation has no mention of sorting the elements


Solution

  • 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