3

I want to filter a calculated field (binary expression in terms of Apple documentation) in Core Data with a NSDecimalNumber value.

The entity has two attributes: field1 and field2, both of type Decimal

The predicate is:

NSDecimalNumber *number = ...;
NSString *predicateString = @"(field1 + field2) <= %@";
NSArray *arguments = [NSArray arrayWithObjects:number, nil];
[NSPredicate predicateWithFormat:predicateString argumentArray:arguments];

But this doesn't work. It gives nothing back.

When i filter each Attribute alone then it works. For example:

NSString *predicateString = @"field1 <= %@"; //ok
NSString *predicateString = @"field2 <= %@"; //ok

What's wrong?

vikingosegundo
  • 52,040
  • 14
  • 137
  • 178
andi
  • 41
  • 2

0 Answers0