Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID
Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.

Filtering it right (it being the NSDictionary)

seecoolguyseecoolguy Posts: 46Registered Users
I've done a number of searches on this site and google, and perhaps I'm just missing the right keyword combinations to find examples on what I want to do.

I have an NSMutableDictionary that I need filtered then sorted (I know I need to put sorted values in an array, so really it's a 2 part question). Some searches on this forum brought me to this thread many other threads have been dead ends and I hope this wont be one of them.

If you know how to do this, please humor me and at least glance over my current dictionary and maybe you'll toss me a sample keyword that I can use to search more on, or maybe some sudo code that I can work with?

here are the results of my nsmutabledictionary:
{item =     {
\"CONF_NO\" = 0004223624;
COUNTER = 00000052;
\"OPERATION_NUMBER\" = 0199;
};
item = {
\"CONF_NO\" = 0004223524;
COUNTER = 00000002;
\"OPERATION_NUMBER\" = 0100;
};
item = {
\"CONF_NO\" = 0004223520;
COUNTER = 00000001;
\"OPERATION_NUMBER\" = 0001;
};
};


now suppose I want to filter and sort by any key value for Operation_number that is between the range of 0100 to 0199. I looked up the documentation on Predicate from the Apple's Predicate Programming Guide, but I'm afraid that I'm still a little bit lost.

It seems that building a predicate would be the right approach, but it almost seems like I need a degree to figure how to construct a predicate for my dictionary object above. :-|

so I tried crafting this simple example by throwing together some snippets of code off the web but it doesn't seem like it's doable either :(




NSPredicate *predicate = [NSPredicate

predicateWithFormat:@\"(OPERATION_NUMBER >= %@) AND (OPERATION_NUMBER <= %@)\",

@\"0100\", @\"0199\"];


doesn't seem to work, and it's quite possible I'm not doing it right :-|

Thank you for reading my post and if you can help, Thanks!
Post edited by seecoolguy on

Replies

Sign In or Register to comment.