Reputation: 3
Apologies if this has been already been answered, I am brand new to SPA applications with Durandal, Knockout and BreezeJS - Entity Framework and brand new to Stackoverflow. The code below is what is giving the error. The p2 is the new line of code I added. If that predicate is removed, the query works fine. But, I need this query to also filter on the expanded table ideaComments.
var p1 = breeze.Predicate.create('ideaId', 'eq', ideaId);
var p2 = breeze.Predicate.create('ideaComments.isAdminComment', '==', false);
var predicate = breeze.Predicate.and([p1, p2]);
var query = EntityQuery.from('Ideas')
.expand(['ideaComments', 'ideaStatus'])
.where(predicate);
The error that is being given is as follows:
Error retreiving data. The parent value for a property access of a property 'IsAdminComment' is not a single value. Property access can only be applied to a single value.
Thank you in advance for any help. :-)
Upvotes: 0
Views: 189
Reputation: 26396
assuming an idea has 0..N idea-comments, you'll need to use the any/all filter operator like this:
var p2 = breeze.Predicate.create('ideaComments', 'any', 'isAdminComment', '==', false);
or this:
var p2 = breeze.Predicate.create('ideaComments', 'all', 'isAdminComment', '==', false);
Upvotes: 2