Skip navigation.
 
mlRe: NSPredicateEditor
FROM : Peter Ammon
DATE : Tue Jan 08 01:08:40 2008

On Jan 7, 2008, at 3:34 PM, Kimo wrote:

> I'm using the NSPredicateEditor template in IB, and it works well. 
> The exception is with a BOOL value.  For example, if I have a BOOL 
> value called flag, and I want to use the string (flag == 1), 
> however, using the NSPredicateEditor always produces the string 
> (flag == "1") which doesn't work.  Is there an option to create the 
> string without the quotes?  Or is there some setting in 
> NSPredicateEditor I'm not aware of?
> TIA.


Hi Kimo,

If you want to have the boolean option be represented by a text 
field, you can of course just select the Numbers type for the right 
expression.  That will coerce the right expressions to a numeric type 
and give you a string like flag == 1.

If (more likely) you want the boolean value to be represented by a 
popup, this can't yet be configured in IB, but it is easy to do 
programmatically.  Create an NSPredicateEditorRowTemplate with left 
expressions your key path expressions, and right expressions as 
constant expressions containing your boolean values.  Then you can 
configure the view titles and all the rest by modifying the 
templateViews.

Let me know if you have any questions,
-Peter

Related mailsAuthorDate
mlNSPredicateEditor Kimo Jan 8, 00:34
mlRe: NSPredicateEditor Peter Ammon Jan 8, 01:08
mlRe: NSPredicateEditor Kimo Jan 24, 21:47
mlRe: NSPredicateEditor Peter Ammon Jan 24, 23:23