0

I need to filter following array with status equal to "U" and i have used following.

 NSArray *result = [alertModified.senders filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"(subscriptions.status = %@)",@"U"]];

But I'm getting empty arrays.

Please help me on filtering this?

Array String:

(senderCode =  CPFB, senderName = CPFB, forSenderLevel = 0, subscriptions = (
"correspondenceListId = 102,status = S,senderCode = AA,subject = Letter,retentionPeriod = 0, uniqueBillIdentifier = (null),senderResponseStatus = (null),subscriptionDate = ,effectiveDate = ",
"correspondenceListId = 103,status = U,senderCode = BB,subject = Nomination Letters,retentionPeriod = 0, uniqueBillIdentifier = (null),senderResponseStatus = (null),subscriptionDate = ,effectiveDate = ",
"correspondenceListId = 104,status = U,senderCode = AA,subject = Yearly statements,retentionPeriod = 0, uniqueBillIdentifier = (null),senderResponseStatus = (null),subscriptionDate = ,effectiveDate = ",
"correspondenceListId = 105,status = U,senderCode = BB,subject = All Future Letters,retentionPeriod = 0, uniqueBillIdentifier = (null),senderResponseStatus = (null),subscriptionDate = ,effectiveDate = "))
lasi
  • 144
  • 1
  • 8

1 Answers1

0

In your example you should be filtering the subscription list itself, not the whole senders. You have to apply the filter to each sender. Try changing your filter line to this and check if it gives you results:

 NSArray *result = [[alertModified.senders objectAtIndex:0].subscriptions filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"(status = %@)",@"U"]];
Angel G. Olloqui
  • 8,045
  • 3
  • 33
  • 31
  • Thanks Angel. But i want to iterate over nested Arrays, not within one arrays. Your code snippet filter within single list. – lasi Apr 16 '12 at 15:15