PDA

View Full Version : [SOLVED] IB - Bindings Inspector - Search Predicate




KieferThomas
Apr 10, 2013, 05:05 PM
See My Reply at bottom of post...

Hello Every One,

In my application I have a search field which is working on two of my text fields the third field is attached to a Text View.

With the following entered into the predicate format I have: date contains[c] $value or title contains[c] $value, this is working for the two text fields but when I enter in: date contains[c] $value or title contains[c] $value or entry contains[c] $value (which entry is linked to a text view) the program throws the following error:

2013-04-10 16:58:04.601 The Journal[2379:303] Can't use in/contains operator with collection <7b5c7274 66315c61 6e73695c 616e7369 63706731 3235325c 636f636f 61727466 31313837 5c636f63 6f617375 62727466 3337300a 7b5c666f 6e747462 6c5c6630 5c667377 6973735c 66636861 72736574 30204865 6c766574 6963613b 7d0a7b5c 636f6c6f 7274626c 3b5c7265 64323535 5c677265 656e3235 355c626c 75653235 353b7d0a 5c706172 645c7478 3536305c 74783131 32305c74 78313638 305c7478 32323430 5c747832 3830305c 74783333 36305c74 78333932 305c7478 34343830 5c747835 3034305c 74783536 30305c74 78363136 305c7478 36373230 5c706172 6469726e 61747572 616c0a0a 5c66305c 66733234 205c6366 30200949 206a7573 7420666f 756e6420 49206861 64206120 656d6169 6c206672 6f6d2043 68726973 20616e64 20686520 6e6f7720 6b6e6f77 73204920 616d2070 69737365 64206162 6f757420 616c6c20 74686520 66696e61 6e636961 6c207472 6f75626c 65206672 6f6d2074 616c6b69 6e672074 6f206d6f 6d2e5c0a 09492068 61766520 6265656e 206f6e20 74686520 62757320 73696e63 6520323a 33302070 2e6d2e20 6f6e206d 79207761 7920746f 20467269 73636f2e 5c0a0949 20646f6e 2774206b 6e6f7720 77686174 20697320 676f696e 6720746f 20686170 70656e20 7768656e 20492067 65742074 68657265 2e7d> (not a collection)
2013-04-10 16:58:04.609 The Journal[2379:303] (
0 CoreFoundation 0x00007fff84c2eb06 __exceptionPreprocess + 198
1 libobjc.A.dylib 0x00007fff87a9f3f0 objc_exception_throw + 43
2 Foundation 0x00007fff8e2262d1 -[NSComparisonPredicateOperator performPrimitiveOperationUsingObject:andObject:] + 0
3 Foundation 0x00007fff8e2c2e34 -[NSPredicateOperator performOperationUsingObject:andObject:] + 116
4 Foundation 0x00007fff8e2c2d26 -[NSComparisonPredicate evaluateWithObject:substitutionVariables:] + 302
5 Foundation 0x00007fff8e23a770 -[NSCompoundPredicateOperator evaluatePredicates:withObject:substitutionVariables:] + 262
6 Foundation 0x00007fff8e23a620 -[NSCompoundPredicate evaluateWithObject:substitutionVariables:] + 282
7 Foundation 0x00007fff8e2c2bf3 -[NSPredicate evaluateWithObject:] + 19
8 Foundation 0x00007fff8e2c2b86 _filterObjectsUsingPredicate + 354
9 Foundation 0x00007fff8e34ff38 -[NSMutableArray(NSPredicateSupport) filterUsingPredicate:] + 285
10 AppKit 0x00007fff89eed5e2 -[NSArrayController _filterObjects:] + 205
11 AppKit 0x00007fff89eb1324 -[NSArrayController _arrangeObjectsWithSelectedObjects:avoidsEmptySelection:operationsMask:useBasis:] + 253
12 AppKit 0x00007fff89cf4cac -[NSArrayController setFilterPredicate:] + 1162
13 Foundation 0x00007fff8e2697f5 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 408
14 Foundation 0x00007fff8e2cd0bf -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 350
15 AppKit 0x00007fff89cece18 -[NSBinder _setValue:forKeyPath:ofObject:mode:validateImmediately:raisesForNotApplicableKeys:error:] + 274
16 AppKit 0x00007fff89ceccad -[NSBinder setValue:forBinding:error:] + 248
17 AppKit 0x00007fff8a34c5a5 -[NSViewStateBinder _setValue:forBinding:errorFallbackMessage:] + 63
18 AppKit 0x00007fff8a2207e2 -[NSSearchFieldBinder performAction:] + 480
19 AppKit 0x00007fff8a37271f -[_NSBindingAdaptor _objectDidTriggerAction:bindingAdaptor:] + 133
20 AppKit 0x00007fff89e717ca -[NSControl sendAction:to:] + 56
21 AppKit 0x00007fff89e7171b -[NSCell _sendActionFrom:] + 138
22 AppKit 0x00007fff8a222051 -[NSSearchFieldCell(NSSearchFieldCell_Local) _sendPartialString] + 164
23 Foundation 0x00007fff8e274af3 __NSFireTimer + 96
24 CoreFoundation 0x00007fff84beb804 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
25 CoreFoundation 0x00007fff84beb31d __CFRunLoopDoTimer + 557
26 CoreFoundation 0x00007fff84bd0ad9 __CFRunLoopRun + 1529
27 CoreFoundation 0x00007fff84bd00e2 CFRunLoopRunSpecific + 290
28 HIToolbox 0x00007fff873e5eb4 RunCurrentEventLoopInMode + 209
29 HIToolbox 0x00007fff873e5c52 ReceiveNextEventCommon + 356
30 HIToolbox 0x00007fff873e5ae3 BlockUntilNextEventMatchingListInMode + 62
31 AppKit 0x00007fff89d81563 _DPSNextEvent + 685
32 AppKit 0x00007fff89d80e22 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 128
33 AppKit 0x00007fff89d781d3 -[NSApplication run] + 517
34 AppKit 0x00007fff89d1cc06 NSApplicationMain + 869
35 The Journal 0x0000000100001252 main + 34
36 libdyld.dylib 0x00007fff8abe37e1 start + 0
37 ??? 0x0000000000000003 0x0 + 3
)

I have been searching all over the net and I cannot find an example of what I need to enter into the predicate format to include the text view field to be searched for the word entered in the search field.

Can anyone help me out here to what I am missing for using IB and the search predicates to search a text view...?

Thanks,
Kiefer



xStep
Apr 10, 2013, 07:53 PM
Show your code.

KieferThomas
May 13, 2013, 11:05 AM
Hello All,

After many, many hours of searching I finally found the answer to this. A NSTextView which is connected to a filterPredicate, (for searching every field in the database). The NSTextView has to have the Allows: Rich Text check box unchecked and the field description in Core Data cannot have an attribute of: Transformable.

Hence forth the following now works for the search predicate using Interface Builder. (field contains[c] $value) where field is a NSTextView attribute.

KieferThomas