I have a problem generating a correct where clause
if(!empty($scriptProperties['worktype'])) {
$data['worktype:IN'] = explode(',', $scriptProperties['worktype']);
}
if(!empty($scriptProperties['salarylowerband'])) {
$data['salarymin:>='] = explode(',', $scriptProperties['salarylowerband']);
}
if(!empty($scriptProperties['salaryupperband'])) {
$data['salarymax:<='] = explode(',', $scriptProperties['salaryupperband']);
}
$data['publishdate:<'] = date("Y-m-d");
$data['unpublishdate:IS'] = null;
$data['OR:unpublishdate:>'] = date("Y-m-d");
// Transform to json
if(!empty($data)) {
$str = json_encode($data);
}
return $str;
It generates (pseudo code)
worktype IN AND salarymin >= AND salarymax <= AND publishdate< AND unpublishdate IS null OR unpublishdate > date("Y-m-d")
What i need is a where clause like
worktype IN AND salarymin >= AND salarymax <= AND publishdate< AND (unpublishdate IS null OR unpublishdate > date("Y-m-d"))
Everything is working fine except the part of the UNPUBLISHDATE. It needs to be in curly braces so it is threated together.
Can somebody help me please...