I created a Fetch Request template in the Predicate Builder in Xcode. Because there are some variables that I want to subtitute with the actual value when executing the request I am using the following method.
-(void)NSManagedObjectModel fetchRequestFromTemplateWithName:substitutionVariables:
My request contains a subquery and the variables are nested in this subquery. Apparently this is causing trouble when substituting the variables. All I get is this error
Unable to generate where clause for predicate ($employer.joinDate < $DATE) (unknown problem)
The subquery is looking something like that
SUBQUERY(employers, $employer, $employer.joinDate < $DATE).@count > 0
However, this method:
-(NSPredicate*)NSPredicate stringWithFormat:
works fine when having the query as a string and format it using dynamic values. Is there any workaround for substituting variables inside subqueries using the template? I would like to have the queries outside the actual code as it's quite handy to edit them in the predicate builder.