hi,

How do I programmatically create the $x.firstname and .@count parts of this 
expression?
SUBQUERY(residents, $x, $x.firstname == "Jane" && $x.lastname == "Doe").@count

When I create a subquery predicate with predicateWithFormat:, the class of the 
$x.firstname and .@count expressions is NSKeyPathExpression and the type is 
NSFunctionExpressionType. The operand is an expression of type 
NSVariableExpressionType or NSSubqueryExpressionType. The function is 
valueForKeyPath:.

When I create an expression with expressionForKeyPath:, the operand is SELF 
instead of the variable or the subquery. When I create an expression with 
expressionForFunction:selectorName:arguments:, the class is 
NSFunctionExpression. When the argument is a keypath expression, instead of 
$x.firstname the expression tries to evaluate $x.Jane and that doesn't work. 
executeFetchRequest throws an exception: -constantValue only defined for 
abstract class.  Define -[NSKeyPathExpression constantValue]!
If the argument is a constant value expression, executeFetchRequest throws an 
exception: -keyPath only defined for abstract class.  Define 
-[NSConstantValueExpression keyPath]!.

The predicate will be edited in a rule editor so I have to convert it to 
criteria and back.
The predicate will be used as filter predicate of an array controller in entity 
mode and/or in a fetch request with Core Data (SQLite).

Thanks,
Willeke_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to