Questions tagged [nscompoundpredicate]

`NSCompoundPredicate` is a subclass of `NSPredicate` used to represent logical “gate” operations (AND/OR/NOT) and comparison operations.

nscompoundpredicate
Filter by
Sorted by
Tagged with
7 votes
1 answer
2k views

Create complicated NSCompoundPredicate in swift 3

I want to create a complicated NSCompoundPredicate in swift 3, however, I don't know how to do this. Suppose I have 5 predicates (p1,p2,p3,p4,p5). I want to implement below conditions: compound1 = (...
Amish Shabani's user avatar
6 votes
3 answers
9k views

NSCompoundPredicate

I'm trying to filter a UITableView's data using a UISearchDisplayController and NSCompoundPredicate. I have a custom cell with 3 UILabels that I want to all be filtered within the search, hence the ...
hedrick's user avatar
  • 211
3 votes
1 answer
1k views

NSCompoundPredicate and Cloudkit

I'm trying to do this with a compound predicate using Cloudkit, but Xcode error says "Unexpected Expression". Anyone know what is wrong with my code? Appreciate any help! let userRef = CKReference(...
Renee Olson's user avatar
2 votes
1 answer
2k views

NSCompoundPredicate error in Xcode 6.1

Back in Xcode 6, in a project using Core Data I had the following line. It worked fine. fetchRequest.predicate = NSCompoundPredicate(type: .AndPredicateType, subpredicates: [predicate, datePredicate])...
Isuru's user avatar
  • 31k
2 votes
2 answers
922 views

How to create NSCompoundPredicate with "empty" predicate

I try to combine more individual predicates into one via NSCompoundPredicate but it may happen that one or more predicates are not constructed because all objects should be retrieved from CoreData ...
Dawy's user avatar
  • 846
2 votes
2 answers
3k views

NSCompoundPredicate Mixing AND and OR

I have started using NSCompoundPredicate to combine my predicates, however have a problem. Here is an example of one predicate: Aircraft *obj = (Aircraft *)[self.managedObjectContext objectWithID:...
Josh Kahane's user avatar
2 votes
1 answer
249 views

NSPredicate to filter beacon according to UUID, major and minor raising exception

I have a beacons array having a collection of CLBeacon and I would like to get only the beacon which matches a given uuid, major and minor in NSPredicate. Below is the code in Object C which is ...
Simant's user avatar
  • 3,562
2 votes
1 answer
3k views

Building an NSCompoundPredicate from array values in Swift

List item So I'm trying to set up a request with multiple conditions in Swift. The SQL equivalent to: select BOARDID from BOARD where BOARDID not like "someBoard" and BOARDID not like "...
Pirijan's user avatar
  • 3,499
2 votes
3 answers
966 views

How to use NSpredicate on array of nested dictionaries

Array format: { "sku": "NikeL101Black", "name": "Nike Black shirt -L", "attribute_set_id": 4, "price": 30, "status": 1, "visibility": 1, "type_id": "simple", "...
devdoe's user avatar
  • 4,287
1 vote
1 answer
112 views

NSPredicate: search for an array of values in relation, NOT

I'm a bit lost, and I hope you can help me. I have two arrays let stars = ["Paul", "Ringo"] let visitors = ["bob", "mary"] Then I have Core Data entities ...
Sjakelien's user avatar
  • 2,285
1 vote
2 answers
63 views

Translate a nested Conditional If Statement into a complex NSCompoundPredicate

I'm writing a macOS target for an old iOS based project using SwiftUI. Is's a Core Data driven application and for the macOS target, I've successfully implemented generic List using a dynamic @...
andrewbuilder's user avatar
1 vote
1 answer
545 views

NSPredicate for filter objects whoes string is BEGINSWITH special characters

I have one scenario where I want to filter the objects of NSArray who have NSDictionary object and every object have key name. I want to filter with that number of objects whose name key value should ...
Ravi B's user avatar
  • 1,582
1 vote
1 answer
109 views

Using NSCompoundPredicate with a list of lists

I have a large list of recipes and inside of each recipe is a list of ingredients. I want to write a query that will return a list of recipes that have both "egg" and "butter". ...
Willy Mac's user avatar
1 vote
1 answer
143 views

Multiple NSPredicates to single Array values in ios

In my projects i'm working in NSPredicate i already worked for a single NSPredicate but now i need to Use multiple NSPredicate.Here i'm having one array, from this array i want to filter by the ...
Test's user avatar
  • 177
0 votes
2 answers
67 views

Fetching entities whose many-to-many relationship contains all terms

I have a model with a Verse entity that has a many-to-many relationship to a Word entity. I'd like to find verses that contain all words that a user is searching for. I'm guessing that it could be ...
user avatar
0 votes
1 answer
403 views

Compound predicate not returning the results

I'm stuck with this problem for a while now I can't seem to think of a way to get it right. I'll try to explain it as clear as I can. There are 3 entities in my core data model. Workplace, Patient ...
Isuru's user avatar
  • 31k
0 votes
1 answer
447 views

iOS Swift Compound Predicate

I'm trying to do a search for specific items within Core Data I have an Entity Colour, which has a NSSet of ProjectColour Entities. The ProjectColour Entities have a field called project which is a ...
Ceri Turner's user avatar
0 votes
1 answer
329 views

NSPredicate search comma separated value with array

Have a entity filed called "keyword" which containing comma separated value like "8275,8276,8277". Now using NSPredicate search those users whose keyword matching on this and the passing value is an ...
Santanu Das Adhikary's user avatar
0 votes
1 answer
240 views

Combining "And" and "Or" on NSPredicates

I want to do something like this: NSPredicate(format: "name contains[cd] %@ AND (position == %@ OR position == %@), name, position1, position2) However, I've tried that and I keep getting serious ...
anders32's user avatar
  • 295
0 votes
0 answers
53 views

Is it possible to include a [NSPredicate predicateWithBlock:] in a NSCompoundPredicate? [duplicate]

I'm trying to make a big filter with a NSCompoundPredicate that includes a BlockPredicate but I get this error: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '...
EnriMR's user avatar
  • 3,964
0 votes
0 answers
230 views

NSCompoundPredicate not filtering array

To test out a restaurant searching app I included 4 test restaurants in a JSON file which populate a table view correctly with their corresponding properties. In 3 text fields I filter the array with ...
Echizzle's user avatar
  • 3,409
0 votes
2 answers
464 views

NSCompoundPredicate construction

Say I have this array of predicates in the feedDays array: <__NSArrayM 0x7ff7f3cd1040>( feedDay == 1, feedDay == 2, feedDay == 4 ) I need to AND it with this statusPredicates array:...
soleil's user avatar
  • 12.7k
0 votes
1 answer
49 views

how to create compoundpredicate within nsFetchRequest that filters by two parameters of different entity

Some background info on my datamodel: manufacturer <-->> item <<-->> tag I currently generate a list of items by a fetchrequest: - (NSFetchRequest*) rankingRequestForItem:(Item*...
user3411663's user avatar
  • 1,041
0 votes
1 answer
43 views

How can I get NSManagedObject from NSExpression?

I have this predicate: DG == <DG: 0x8c8dbd0> (entity: DG; id: 0x8c91140 <x-coredata://5F7ECBA0-D9B4-489A-85DA-3BE10A8D65CB-94947-00026842BC158909/DG/p2> ; data: <fault>) How can I ...
János's user avatar
  • 34.1k