I have three tables, with the following structure:
http://dl.dropbox.com/u/2586403/ORMIssues/TableLayout.png
The three objects I\'m dealing with are here:
I solved this one with Sam's help, by setting up a method in my Service that returned the items in the order I wanted. I just used ORMExecuteQuery to get the items in the right order, and if there were no items, just returned an empty array.
The final method looked like this, where specifications are set directly in the object in the order I want them:
/**
@hint Gets a SpecGroups object based on ID. Pass 0 to retrieve a new empty SpecGroups object
@ID the numeric ID of the SpecGroups to return
@roles Admin, User
*/
remote ORM.SpecGroups function getSpecGroup(required numeric ID){
if(Arguments.ID EQ 0){
return New ORM.SpecGroups();
}else{
LOCAL.SpecGroup = EntityLoadByPK("SpecGroups", Arguments.ID);
LOCAL.SpecsInGroup = ORMExecuteQuery("SELECT Spec FROM SpecInGroup G WHERE G.SpecGroupID = :GroupID ORDER BY SpecLabel, SpecName", {GroupID = LOCAL.SpecGroup.getID()});
LOCAL.SpecGroup.setSpecifications(LOCAL.SpecsInGroup);
return LOCAL.SpecGroup;
}
}