PDA

View Full Version : Filtering NSPredicates after numerical value?


robertseadog
2006.05.08, 07:48 AM
Hi all!
Lately I've been tearing my hair off trying to get my MO search to sort after numerical value (that is; the smallest value first, and upwards we go )..
For some reason I can't find any examples of it in the apple guide - all they got is direct matches ex: SELF contains[c] 'Mathilde' I've also searched for regex ways of doing this, but that seems to be search and find to - And seem to have little to do with the sorting..

So, is there anyway ( with or without NSPredicate ) to sort my managedObjects in numerical fashion? Edit: I just found this; Apple Docs (http://developer.apple.com/documentation/DeveloperTools/Conceptual/XcodeUserGuide/Contents/Resources/en.lproj/02_05_eo_model/chapter_16_section_10.html#//apple_ref/doc/uid/TP40002675-SW49) But I can't find any reference to any "Fetch specification" in my datamodel.. I just downloaded Xcode 2.2.1, anyone know how to get that panel up?

Thanks in advance!

Taxxodium
2006.05.08, 10:34 AM
SELF contains[c] $value

does that work?

Check out this tutorial on that (at the end): http://developer.apple.com/cocoa/coredatatutorial/index.html

robertseadog
2006.05.08, 01:01 PM
well, I don't want to restrict it to any value, I just want to sort them all after whos smallest..

robertseadog
2006.05.10, 08:49 AM
Oh man! *SLAP* I forgot about NSSortDescriptor! That will do the trick this time, but it sure would be neat if CD could sort it for me! :p