Hi,
I’ve got an NSMutableArray which i am now able to add to and sort (thanks Shane!) - but now i have another question.
I’d like to find out how many of the records in the array have been filled in - I have a status field which is set to “1” when it has been filled in - so all i need to do is count the number of records whose “status” is “1” - but i have no idea how to do that…
Any help greatfully appreciated!
OLIx
You can use NSPredicate. Something like:
set aPredicate to current application's NSPredicate's predicateWithFormat_("status = '1'")
set theCount to anArray's filteredArrayUsingPredicate_(aPredicate)'s count()
I don’t know if i had to, but I added pipes around the |count| and it worked perfectly…
And also using the predicate method I created new arrays just with the filled in records - so thank you so much again Shane…
OLIx
(ps amazingly this is all just for a Eurovision party scoreboard - so my next challenge will be presenting the results elegantly - so there may be more questions on the way!)