getRecords - Date Field Filter
4 posts by 3 authors in: Forums > CMS Builder
Last Post: January 29, 2013 (RSS)
Hello, All
I need to define a where clause in a getRecords function that will filter out a particular field. In this instance the field in question is a date field. I want getRecords to bypass all records in which a date has been submitted. In effect it needs to say:
where => ' date is empty '
Or some such thing!
:0)
Perch
By rconring - January 27, 2013
I too just finished struggling with this problem except I needed all with no date where you need the opposite.
I found that this works but don't know if there is a better way:
'where' => "ship_date != '0000-00-00 00:00:00'", // filters out all with no date.
since date fields are stored padded with zeros and is not as a NULL
Conring Automation Services
----------------------------------------
Software for Business and Industry Since 1987
Hi Perch,
You might also give this plugin a try. Dave created it a few years back.
it blanks out fields on input that are submitted with nothing but whitespace and field on output with zero'd out (blank) dates.
Best,
Jerry Kornbluth
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php