Edit NSPredicate using NSPredicateEditor

239 views Asked by At

I have a NSPredicateEditor from which I want to extract the predicate as a string. I'm using the following code:

[[predicateEditor objectValue] description]

and it extract the predicate in a form like this:

"Author" MATCHES "John"

the problem is that in this predicate I can't find any hint about the first part of the NSPredicateEditor, the ANY/ALL part.

enter image description here

How can I extract it in NSString form? Thanks

1

There are 1 answers

0
pkamb On

The issue here is that for a single case the predicate intrinsically/logically contains "ALL" behavior, without the "ALL" string actually needing to be set in the predicate.

Logically "author matches john" is the same as "ALL(author matches john").

If you create an NSCompoundPredicate and set it as the NSPredicateEditor's objectValue the "All" row should be displayed automatically, even if the predicate format string itself does not contain the string "ALL". But setting a standard NSPredicate (rather than NSCompoundPredicate) may not give you the ALL row.