I'm using two radiobuttons in advanced search form, they are reviewed and not reviewed. When I click on reviewed it should filter for multiple search box in Gridview and display the result. There are other three fields 'Updated date','reviewed date' and 'created date' also. Suppose, I click on the reviewed button. It should check for the condition updated time is greater than created date and reviewed date is default value(0000-00-00 00:00:00) and display the results in gridview.
SQL query-Select * from test where (updateddate>createddate)and(revieweddate=='0000-00-00 00:00:00');
Similarly, when I click not reviewed, it should check for updateddate=createddate and revieweddate=NULL.
SQL query-Select * from test where (updateddate=createddate)and(revieweddate IS NULL);
Below is the code what I have tried, but I'm not getting proper results. How can I execute the correct results.
$criteria->compare('ReviewedDate',$this->ReviewedDate,true);
if($this->ReviewedDate != '') {
$criteria->addCondition(
'ReviewedDate ' . ($this->ReviewedDate=='1' ? 'IS NOT NULL' : 'IS NULL'));
}
else {
$criteria->addCondition('ReviewedDate IS NULL');
}