how to use nspredicate for this?
<p>i am stuck with using nspredicate in the following code:</p>

<pre><code>for (int i=0; i&lt;[nodes count]; i++)
{
    NSMutableDictionary *dict=[nodes objectAtIndex:i];

    NSInteger docid = [[dict objectForKey:@"docid"] integerValue];
    NSString *strPred = [NSString stringWithFormat:@"docId == %i",docid];
    [request setPredicate:[NSPredicate predicateWithFormat:strPred]];
    NSArray* objects=[[context executeFetchRequest:request error:nil] retain];
   NSPredicate *objCount = [NSPredicate predicateWithFormat:[objects count]];

    if([objects count])//how do i reduce these if else block too using nsprdicate
    {
        [dict setObject:@"1" forKey:@"isbookthere"];
    }
    else
    {
        [dict setObject:@"0" forKey:@"isbookthere"];
    }
    [objects release];
    [nodes replaceObjectAtIndex:i withObject:dict];
}
</code></pre>

<p>i have to remove the ifelse block too since, if the count goes to 4000 the the loop goes for those many iterations which cause problem,so inorder to reduce this risk i am suppose to use NSPredicate.</p>
