Hello,
I have a problem with date filter in a query,
This is the code:
filters: { a!queryFilter( field: "fechaVencimiento", operator:">", value: toDate(now()) ),
fechaVencimiento is date of BBDD.
The problem is that when I execute the query it is returning the last two records, while I should not return anything because those records have the current date but not greater.
Do you know any solution for this?
Regards, and thank you very much
Discussion posts and replies are publicly visible
I would suggest you try it without "toDate()" -- either try just "now()", or try "today()" to return a datetime value with just the date (i believe either of these should work for your filter though).
If that still doesn't seem to work right, you might want to check that the CDT used by the Data Store Entity you're querying from has the "fechaVencimiento" column declared as the correct data type (i.e. that it's date, and not text or something else incorrect).
Hello Mike,
fechaVencimiento in CDT is DATE.
if I put what you told me about now () or today () without the hit () it returns the following error:
you can think of another alternative?
My first instinct is to suggest you keep hunting for any issues with your particular configuration, because I've done this many times and it's always worked without much trouble.
All right Mike, I finally deleted the CDT and generating it again worked
Thanks, that's useful to know. I suspect someone may have updated the CDT via the editor without updating its data type in the XSD file, though it's hard to know for sure what exactly happened.