I have a NSArray that contains dictionary objects. The structure of array looks like this:
Data = (
{
Date = "07/11/2013";
LotNumber = 1;
PartyName = "Gaurav Wadhwani";
Quantity = 500;
},
{
Date = "07/11/2013";
LotNumber = 2;
PartyName = "Gaurav Wadhwani";
Quantity = 600;
}
)
I am using a Search and Display controller which allows the user to search through LotNumber, PartyName or Date. I know how to use Scope titles and search bar. However, I am unable to use NSPredicate to get correct results. This is my code:
NSString *searchParameter = @"LotNumber";
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"%K contains[cd] %@", searchParameter, searchText];
filteredGoodsArray = [NSMutableArray arrayWithArray:[data filteredArrayUsingPredicate:predicate]];
NSLog(@"Filtered Array = %@", filteredGoodsArray);
I always get blank results in filtered array. Could you tell me what's wrong here?
Thank You.
LotNumberanNSNumberin the dictionary? - Wain