Value transformer in NSPredicate?
Value transformer in NSPredicate?
- Subject: Value transformer in NSPredicate?
- From: Justin Hawkwood <email@hidden>
- Date: Tue, 10 Apr 2007 12:13:55 -0700
I created a NSValueTransformer (basically: float * 100 = int, and
vice versa) which is used in the NIB file to transform the value in a
Core Data bound table column. This works well, but I would like to
use the transformer in a filter predicate which I am creating
programatically, but I cannot figure out how to call the transformer
to edit the value before comparing it.
What I would like is something that looks like this:
+ (void)initialize
{
MyValTrans * myValTrans [[[MyValTrans alloc] init] autorelease];
[NSValueTransformer setValueTransformer: myValTrans
forName:@"transThisVal"];
}
- (IBAction)filterTable:(id)sender
{
[arrayCtrl setFilterPredicate:[NSPredicate predicateWithFormat:
@"[ transThisVal transformedValue: attribName].description contains
[c] %@",
[[searchFilter cell] stringValue]];
}
But this is no where near accurate, in fact I just made it up, but
that is the concept I'm looking for; transforming the attribute
value prior to comparison.
I have been able to alter the argument [[searchFilter cell]
stringValue] to barely function (rather than crash) but it does not
and cannot be altered to work as expected.
Suggestions of how to transform the value prior to comparison?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden