开发者

nspredicate problem with AND operation

开发者 https://www.devze.com 2023-04-08 14:26 出处:网络
I am stuckup with below line and i am not have much knowledge on coredata , `NSPredicate *predicate = [NSPredicate predicateWithFormat:@\"(bookPath == %@) AND (accessed==%u)) AND (isCurrentSession==%

I am stuck up with below line and i am not have much knowledge on coredata ,

`NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(bookPath == %@) AND (accessed==%u)) AND (isCurrentSession==%u)", myString,[NSNumber numberWithBool:NO],[NSNumber numberWithBool:_accessed]];` 

upto now i sent t开发者_JAVA百科wo values to my predicate, in the above predicate i am using three values,

My Question: can we apply two AND operations in a single predicate, can any one provide some idea about this.Thanks in Advance.


Yes, you should be able to combine predicates with 'AND' and 'OR' to an arbitrary level of complexity. The formal parser grammar for the predicate syntax can be found here.

For best performance you should order your predicate terms so that simple tests (e.g numeric comparisons) appear first in the format string and more complex tests (e.g. REGEX pattern matching) appear last.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号