NSPredicate获得儿童的孩子 [英] NSPredicate to get children's children's

查看:109
本文介绍了NSPredicate获得儿童的孩子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我要抓取所有的治疗,这是List对象的孩子。



我不知道是否可以做。



我有一个TableView显示所有病人的列表。每个病人可以有很多治疗。



我有一个对当前列表的引用,并希望使用它以某种方式查找子级的子级。



谢谢

解决方案

使用谓语

  [NSPredicate predicateWithFormat:@ofPatient.ofList =%@,currentList] 

$使用治疗 - >患者 - >列表中的逆向关系来处理b
$ b


I want to fetch all the treatments, that are children of this List object.

I am not sure if it can be done.

I have a TableView showing all the patients of a list. Each patient can have many treatments.

I have a reference to the current list, and want to use that to somehow find the childrens children.

Thank you

解决方案

Use a fetch request for the "Treatment" entity with the predicate

[NSPredicate predicateWithFormat:@"ofPatient.ofList = %@", currentList]

using the inverse relationships from "Treatment" -> "Patient" -> "List".

这篇关于NSPredicate获得儿童的孩子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆