Finally! fetch and sort w/o a display group
Finally! fetch and sort w/o a display group
- Subject: Finally! fetch and sort w/o a display group
- From: Nathan Dumar <email@hidden>
- Date: Fri, 4 Jun 2004 16:06:18 -0400
Here's the final form:
try {
// fetch users of this family
users = EOUtilities.objectsMatchingKeyAndValue(edCon(), "User",
"family", theFamily);
// remove master and admin users from the list
EOQualifier q =
EOQualifier.qualifierWithQualifierFormat("(usertype.userTypeNumber > 0)
and (usertype.userTypeNumber < 9)", null);
users = EOQualifier.filteredArrayWithQualifier(users, q);
// sort remaining users by real name
EOSortOrdering realNameOrdering =
EOSortOrdering.sortOrderingWithKey("realName",
EOSortOrdering.CompareAscending);
NSArray nameOrdering = new NSArray(realNameOrdering);
users = EOSortOrdering.sortedArrayUsingKeyOrderArray(users,
nameOrdering);
}
So much work for so little code, when I'm doing something for the first
time. I learned to program with Java and WO, so my patience is good.
I'm still learning.
Thank you Art, for helping me with a fetch that I couldn't easily do
with a WODisplayGroup. I could never get objectsWithQualifierFormat to
work, despite hours of trying everything I could think of. I kept
getting null pointer exception errors ... never did figure out why, but
I did get objectsMatchingKeyAndValue to work, and did the rest with a
qualifier. I'm pretty amazed that my first attempt at using an
EOQualifier was successful. Anyway, you got me out of my
WODisplayGroup rut. I'll still be using them, but I've learned when
and how to get by without them.
Also thank you to Art, George, and Ray for helping me get objects
sorted without the display group. I was thinking in terms of an array,
instead of in terms of enterprise objects in an object graph.
Another obstacle down. Thanks again.
Nathan
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.