cocoa - NSPredicate for 2-level drill-down? -


a core data entity has to-many relationship entity b, has to-many relationship entity c, has 2 attributes:type , value.

a =>> b =>> c (so: a.bs.cs.type, a.bs.cs.value)

whats nsarray filter predicate a's have b has c has (type=='test1' && value=='test2')?

the subquery samples i've seen go 1 level deep.

i tried [nscompoundpredicate andpredicatewithsubpredicates:] subpredicate 1) "any bs.cs.type=='test1'" , subpredicate 2) "any bs.cs.value=='test2'", nothing returned.

yes, i've looked @ nspredicate & friends docs, can't find multi-level drilldowns.

you need use nsexpression +expressionforsubquery:usingiteratorvariable:predicate: or expression syntax documented there.

i think case like

(subquery(bs, $b,     subquery($b.cs, $c, $c.type=='text1' && $c.value='test2').@count != 0  ).@count != 0) 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -