some how a Criteria: associations + not + ilike does not give a good result. I still get cases with actions that have the status I don't want in the result. Any clue or suggestion for other approaches?
I have this in controller:
def pgp = [:]
pgp.max = params.max?.toInteger() ?: 20;
pgp.offset = params.offset?.toInteger() ?: 0
pgp.max = 20;
def result = Case.createCriteria().list(pgp) {
actions {
not {
and {
ilike("status","%CLOSED")
ilike("status","%Installed in PRD")
}
}
}
}
This is the relevant Domain snipped:
class Case {
String caseCode
String caseName
String caseType
static hasMany = [ actions : Action ]
I'm on Grails 2.4.4
Your Boolean logic is faulty - the and
should be an or
. Your current tests will be true for every possible value of status
, as any value that passes ilike("status","%CLOSED")
will fail ilike("status","%Installed in PRD")
and vice versa.