• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Value transformer in NSPredicate?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Value transformer in NSPredicate?
      • From: "John R. Timmer" <email@hidden>
  • Prev by Date: Re: Hanging after autorelease...
  • Next by Date: Re: Hanging after autorelease...
  • Previous by thread: Re: Filevault and SUID Incompatibilities
  • Next by thread: Re: Value transformer in NSPredicate?
  • Index(es):
    • Date
    • Thread