Re: @count keypath in qualifier
Re: @count keypath in qualifier
- Subject: Re: @count keypath in qualifier
- From: email@hidden
- Date: Wed, 3 Aug 2005 13:28:00 +0200
Hi!
The ExistsInRelationshipQualifier on
my web page (http://homepage.mac.com/i_love_my/code.html) can do exactly
that.
Actually initial versions of the qualifier
checked only if there was at least one element in the relationship. Newer
version allow for the caller to specify any minimum number of matches.
Should the version on my web page not yet have the full feature, I will
update the published version on request.
Pierre
webobjects-dev-bounces+pierre.bernard=email@hidden
wrote on 08/03/2005 01:01:39 PM:
> 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 >
> > 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
>
**********************************************************************
This email and any files transmitted with it are intended solely for
the use of the individual or entity to whom they are addressed.
If you have received this email in error please notify the sender
of this message. (email@hidden)
This email message has been checked for the presence of computer
viruses; however this protection does not ensure this message is
virus free.
Banque centrale du Luxembourg; Tel ++352-4774-1; http://www.bcl.lu
**********************************************************************
_______________________________________________
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