daniel
daniel

Reputation: 35693

nested predicates in breeze.js

Is it possible to use some sort of nested predicates in breeze.js?

I want something like (a) and(b or c or d))

I am only able to chain the predicates without the logical brackets with:

 predicates = predicates.and(a);
 predicates = predicates.or(b);
 predicates = predicates.or(c);
 predicates = predicates.or(d); 
 // predicates not nested: a and b or c or d

Upvotes: 1

Views: 128

Answers (1)

gustavodidomenico
gustavodidomenico

Reputation: 4681

You should compose your predicates:

var leftSide = predicates.or(b).or(c).or(d);
var composedPredicate = leftSide.and(a);

It will give you:

(b or c or d) and a

Edit:

Just found a very useful thread:

How do I write a breeze Predicate equivalent to the following SQL

Upvotes: 2

Related Questions