Thanks. As I said, I already read that but it doesn't give any
examples on how to format subqueries. Anyway, I ended up adding a
helper method to my subclass after all. It returns a single array of
keywords, which I can examine using a predicate with format "(ANY
keywords contains[c] %@, searchString)". It works fine. Perhaps even
faster than running a subquery, I dunno.

F.

On Mon, Jul 28, 2008 at 11:12 AM, Conrad Taylor <[EMAIL PROTECTED]> wrote:
> Hi, I would recommend taking a look at the following document.
>
> http://developer.apple.com/documentation/Cocoa/Conceptual/Predicates/predicates.html
> Good luck,
>
> -Conrad
>
> On Mon, Jul 28, 2008 at 1:02 AM, Fabian <[EMAIL PROTECTED]> wrote:
>
>> Thanks. Maybe I should have made myself a little more clear. I don't
>> want to iterate over the array, but filter the array using a
>> NSPredicate.
>>
>> I'm looking at the Predicate Programming Guide, which only gives basic
>> guidance, and the docs for NSExpression. It has several class methods
>> that "sound right" (expressionForEvaluatedObject:,
>> expressionForAggregate:,
>> expressionForSubquery:usingIteratorVariable:predicate:,
>> expressionForFunction:arguments:) but provides no examples how to use
>> them. Unfortunately Google has very little to say on this subject too.
>>
>> To repeat the problem: I want to check the value of all keys in every
>> dictionary contained by an array and see if they match my search
>> string.
>>
>> A workaround to compensate for my syntax ignorance would be to add a
>> new instance method to my custom class that simply return all the
>> values I want to check in a single array. Then I could query it with a
>> simple single-relationship predicate:
>>
>> NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(%@ IN
>> values, searchString)"];
>> NSArray filteredArray = [myArray filteredArrayUsingPredicate:predicate];
>>
>> But somehow I believe there is a more direct way to do this, without
>> having to add a new "helper method" to my class? I'm perfectly happy
>> with a 10.5 only solution.
>>
>> Thanks.
>>
>>
>> On Mon, Jul 28, 2008 at 8:30 AM, Graham Cox <[EMAIL PROTECTED]>
>> wrote:
>> >
>> > On 28 Jul 2008, at 1:52 pm, Omar Qazi wrote:
>> >
>> >> To be honest, I don't know if this will work, since I don't know if
>> >> containsObject is checking if the argument is a pointer to an object in
>> the
>> >> array, or if it is equal to the object, but it's better than nothing, I
>> >> guess.
>> >
>> >
>> > From the docs:
>> >
>> > containsObject:
>> > Returns a Boolean value that indicates whether a given object is present
>> in
>> > the receiver.
>> >
>> > - (BOOL)containsObject:(id)anObject
>> >
>> > Parameters
>> >
>> > anObject
>> > An object.
>> >
>> > Return Value
>> > YES if anObject is present in the receiver, otherwise NO.
>> >
>> > Discussion
>> > This method determines whether anObject is present in the receiver by
>> > sending an isEqual: message to each of the receiver's objects (and
>> passing
>> > anObject as the parameter to each isEqual: message).
>> >
>> > Availability
>> >        • Available in Mac OS X v10.0 and later.
>> >
>> >
>> >
>> >
>> > cheers, Graham
>> _______________________________________________
>>
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/conradwt%40gmail.com
>>
>> This email sent to [EMAIL PROTECTED]
>>
> _______________________________________________
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/slasktrattenator%40gmail.com
>
> This email sent to [EMAIL PROTECTED]
>
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to