Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grails query not inList

I'm writing a criteria to make a query, but I can't figure out how to negate an inList criteria...Is there a way to do something like:

def result = c {
     not inList('id', ids)
}

Thanks

like image 837
rascio Avatar asked May 02 '12 11:05

rascio


1 Answers

Your criteria should like this...

def ids = [1, 2, 3];

def c = Foo.createCriteria();
def results = c.list {
  not {'in'("id",ids)}
}

The documentation can be found here. I believe this was just added in grails 2.+

like image 97
Michael J. Lee Avatar answered Nov 19 '22 10:11

Michael J. Lee