NSPredicate for filtering Retrieving results
I'm trying to predict an array with this - (void) searchBar: (UISearchBar *) searchBar textDidChange: (NSString *) text {
if(text.length == 0)
{
isFiltered = FALSE;
}
else
{
isFiltered = true;
filteredListCustomersArray = [[NSMutableArray alloc]initWithCapacity:[customersArray count]];
[filteredListCustomersArray removeAllObjects];
NSPredicate *filterPredicate = [NSPredicate predicateWithFormat:@"SELF.text contains[c] %@",text];
filteredListCustomersArray = [NSMutableArray arrayWithArray:[customersArray filteredArrayUsingPredicate:filterPredicate]];
searchText=text;
}
[customerstableView reloadData];
}
I cannot get the results. Please help me with this,
<__NSArrayM 0x608000458480>(
{
FLD = (
{
NAME = BPCNUM;
TYPE = Char;
text = ACTR001;
},
{
NAME = BPCNAM;
TYPE = Char;
text = "Regal Enterprises";
},
{
NAME = BPCSHO;
TYPE = Char;
text = Regal;
}
);
NUM = 1;
},
{
FLD = (
{
NAME = BPCNUM;
TYPE = Char;
text = ACTR003;
},
{
NAME = BPCNAM;
TYPE = Char;
text = "Mace Supplies";
},
{
NAME = BPCSHO;
TYPE = Char;
text = Mace;
}
);
NUM = 2;
})
Here I want text = "Regal Enterprises" for the predicate
+3
source to share