Hi there
I have a custom entity with a "date field".
I have created a "notStorable" field to calculate the diff between that date field and CURDATE()
I would like to create a filter in a select Manager to filter rows that have my diff field between X and Y days
but in my select manager function, i cannot use my notStorable field "diffDateField"
is it normal ?
I try to write some SQL directly there but not working neither
Any idea about how i could handle that?
I have a custom entity with a "date field".
I have created a "notStorable" field to calculate the diff between that date field and CURDATE()
Code:
"diffDateField": {
"notStorable": true,
"type": "float",
"required": false,
"readOnly": true,
"isCustom": true,
"select": "DATEDIFF(mytable.my_date_time_field, CURDATE())",
"orderBy": "mytable.my_date_time_field {direction}"
},
but in my select manager function, i cannot use my notStorable field "diffDateField"
is it normal ?
I try to write some SQL directly there but not working neither
Code:
protected function filterCustomJ14(&$result) {
$this->addOrWhere(array(
array('DATEDIFF(mytable.my_date_time_field, curdate())' => 'BETWEEN 0 AND 14')
), $result);
}
Code:
[2019-03-29 10:06:00] Espo.ERROR: API [GET]:/:controller, Params:Array ( [controller] => xxx) , InputData: - SQLSTATE[42S22]: Column not found: 1054 Unknown column 'DATEDIFFmytable.my_date_time_fieldcurdate' in 'where clause' [] []
