Re: @count keypath in qualifier
Re: @count keypath in qualifier
- Subject: Re: @count keypath in qualifier
- From: "Jerry W. Walker" <email@hidden>
- Date: Wed, 3 Aug 2005 07:01:39 -0400
Hi, Greg,
On Aug 2, 2005, at 8:33 PM, Greg wrote:
I am trying to construct a qualifier that will count the items in a
relationship. I have sale.@count, but it is throwing an exception
when trying to parse the @ character. Is it possible to use this
type of kvc in a qualifier?
No.
I no of no way to effect this kind of test directly in an
EOQualifier. Others might be more helpful there.
Any help is greatly appreciated.
The two alternatives I would suggest are:
1) Construct a SQL statement to do the select directly and issue
a rawRowsForSQL()
2) Fetch all the Client objects that match onlyWantingContact and
filter the array in memory.
Regards,
Jerry
public static NSArray allClientsWhoHaventSignedUpWantingEmail
(EOEditingContext ec) {
EOSortOrdering lastName = EOSortOrdering.sortOrderingWithKey
("lastName", EOSortOrdering.CompareCaseInsensitiveAscending);
EOSortOrdering firstName =
EOSortOrdering.sortOrderingWithKey("firstName",
EOSortOrdering.CompareCaseInsensitiveAscending);
NSMutableArray order = new NSMutableArray();
order.addObject(lastName);
order.addObject(firstName);
EOQualifier onlyWantingContact =
EOQualifier.qualifierWithQualifierFormat("wantsEmailContact = %@",
new NSArray(new Boolean(true)));
EOQualifier hasMoreThan1Sale =
EOQualifier.qualifierWithQualifierFormat("sales.@count > 1", null);
EOQualifier objs[] = { onlyWantingContact, hasMoreThan1Sale };
EOAndQualifier ands = new EOAndQualifier(new NSArray(objs));
EOFetchSpecification fetchSpec = new EOFetchSpecification
("Client", ands, order);
return ec.objectsWithFetchSpecification(fetchSpec);
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40codefab.com
This email sent to email@hidden
--
__ Jerry W. Walker, Partner
C o d e F a b, LLC - "High Performance Industrial Strength
Internet Enabled Systems"
email@hidden
212 465 8484 X-102 office
212 465 9178 fax
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden