Xavier -

I'm not certain, but I think that might be as good as you're going to get with a fetch spec.  Can you forgo the db sorting (fetch spec sorting) and after the nsarray is populated, sort it and do what you want?  

public NSArray topProductList() {
NSMutableArray sortOrderings = new NSMutableArray();
EOQualifier qualifier = EOQualifier.qualifierWithQualifierFormat("(favorite <> null)", null);
EOFetchSpecification fetchSpec = new EOFetchSpecification("Product", qualifier , null);
NSArray retval editingContext.objectsWithFetchSpecification(fetchSpec);
EOSortOrdering newSO = new EOSortOrdering("favorite", EOSortOrdering.CompareCaseInsensitiveDescending);
return EOSortOrdering.sortedArrayUsingKeyOrderArray(retval, new NSArray(newSO));
}

On Sep 25, 2006, at 10:32 AM, Dev WO wrote:

OK, I had to do it one day or another, so I installed and started using Wonder.
I've done some searching to see if I could get something for my sorting, but I didn't find anything for now...

So I'm updating my question with "do you have a tip with or without Wonder":)

Thanks

Xavier


Hi,
I've got a hard time trying to get the fetch I want:), here's what I have:
a parent entity "Product" which is abstract and 2 sub-entities "ProductA" and "ProductB" (one table for A and one for B in the database).
A and B shares a common attribute "favorite" (define in Product) which is a NSTimestamp.
If I try to fetch "Product" to get only product with a "favorite" NSTimestamp and sort it, I got 2 joined fetches... which is I first got the "ProductA" sorted correctly then the "ProductB" also sorted correctly. I'm not sure I explain this correctly, I mean the fetch isn't "Product sorted by favorite NSTimestamp" but instead "ProductA sorted by favorite NSTimestamp +ProductB sorted by favorite NSTimestamp".

Here's what I'm using to fetch:
public NSArray topProductList() {
NSMutableArray sortOrderings = new NSMutableArray();
EOSortOrdering newSO = new EOSortOrdering("favorite", EOSortOrdering.CompareCaseInsensitiveDescending);
sortOrderings.addObject(newSO);
EOQualifier qualifier = EOQualifier.qualifierWithQualifierFormat("(favorite <> null)", null);
EOFetchSpecification fetchSpec = new EOFetchSpecification("Product", qualifier , sortOrderings);
return new NSArray(editingContext.objectsWithFetchSpecification(fetchSpec));
}


I need to be able to get only the x last favorite, but actually it will only return ProductA (as long as there's more than x ProductA with a favorite NSTimestamp), so even if I have a more recent favorite ProductB, I can't get it...

Does anyone know how I can get a fetch really sorted on the parent entity?

Thanks

Xavier

PS: If there's a way not involving Project Wonder it would be really nice. I'm going to "upgrade" this project with Wonder after it is delivered, but actually I'm already late on the delivery and I can't afford the time to test everything to see if it works on Wonder, especially I have a custom WOHyperlink so I'm not sure it won't break using Wonder...But I may be wrong;)
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:

This email sent to [EMAIL PROTECTED]

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:

This email sent to [EMAIL PROTECTED]

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com

Reply via email to