I’ve got a problem using foundset.find(), foundset.search() methods instead of running a query in the situation where I need to have brackets (as for a sql query brackets). I’ll explain the situation as it is, so if somebody can help me doing it.
I have 30 assignments assigned to different employees and resources. Each of this assignments has got an assignment type and a status code. I want to do a search over all these assignments and get the assignments that have the following conditions:
[employee = employee1 OR resource = resource1] AND [[status = statuscode1 OR status = statuscode2] AND assignmenttype = assignmenttype1 ]
I don’t know how can I do the above search in a single
var fs = foundset; // you can make fs.duplicateFoundSet() if you would like to find/search in a separate foundset
if(fs.find()){
if(employee1){
fs.employee = employee1;
} else {
fs.resource = resource1;
}
if(statuscode1){
fs.status = statuscode1;
} else {
fs.status = statuscode2;
}
fs.assignmenttype = assignmenttype1;
var result = fs.search();
controller.loadRecords(fs);
}
I don’t think this would work.
Both employee1 and resource1 are not null, we need to select all records that have either employee = employee1 OR resource = resource1.
Speaking in general terms, how do we implement something like “SELECT * FROM table WHERE (table.column1 = ? OR table.column2 = ?) AND (table.column3 = ? OR table.column4 = ?) AND table.column5 = ?” via Servoy .find()/.search()?
The brackets are a problem.