Reputation: 611
I have the following Grails withCriteria structure:
allInfo = Scholarship.withCriteria {
between('gpa', '0', gpa)
grades {
idEq year
}
scholarshipCounties {
eq('county.id', county)
}
majors {
idEq major
}
activities {
idEq activity
}
eq('specialTypeInd', special)
}
I want this to return scholarships by (gpa AND grades AND majors) OR scholarshipCounties OR activities OR specialTypeInd.
Upvotes: 0
Views: 248
Reputation: 20699
you should be using respective or{}
and and{}
clauses:
allInfo = Scholarship.withCriteria {
and{
between('gpa', '0', gpa)
grades {
idEq year
}
majors {
idEq major
}
}
or{
scholarshipCounties {
eq('county.id', county)
}
activities {
idEq activity
}
eq('specialTypeInd', special)
}
}
Upvotes: 1