0

My Entity Office have set of File entities. Each File has uuid property. I need to fetch offices where we have any file where UUID is not in set of Strings

I tried to use

let predicate = NSPredicate(format: "NOT (ALL files.uuid IN %@)", uuidSet)
let predicate = NSPredicate(format: "ANY files.uuid NOT IN %@", uuidSet)
let predicate = NSPredicate(format: "ANY NOT files.uuid IN %@", uuidSet)

I always get the error like

exception 'NSInvalidArgumentException', reason: 'Unsupported predicate NOT ALL files.uuid IN {"C0DF0E67-ED8A-4D3B-87A1-E4E7B86967AA"}'

Is there a way to write this Predicate properly? Because right now I only see the solution to load all offices and then iterate through every item.

Paul T.
  • 4,938
  • 7
  • 45
  • 93
  • let predicate = NSPredicate(format: "NOT(files.uuid IN %@)", uuidSet) take a look at https://stackoverflow.com/questions/8580715/nsarray-with-nspredicate-using-not-in – Sandeep Bhandari Mar 21 '18 at 11:15
  • @SandeepBhandari , in the provided question CategoryId is just property for one object. But in my case files are set of objects. So it gives the error "exception 'NSInvalidArgumentException', reason: 'unimplemented SQL generation for predicate : (files.uuid IN {"C0DF0E67-ED8A-4D3B-87A1-E4E7B86967AA"})'" – Paul T. Mar 21 '18 at 11:20

0 Answers0