How to create an expression?
How to create an expression?
- Subject: How to create an expression?
- From: Willeke <email@hidden>
- Date: Mon, 26 Sep 2011 16:05:19 +0200
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 (email@hidden)
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:
This email sent to email@hidden