OQL: Where date today

Dear community members, I want to use a dataset that only shows the record created today. I have added the following where clause to the OQL statement. WHERE Object/Order_Date = '[%CurrentDateTime%]' This sould only show the the orders equal tot the CurrentDateTime however this is not the case. How could i get this done?
4 answers

If you add a daterange in your GUI it generates

AND CreateTime in $DateRange

Where CreateTime is my date-time attribute. And try

<= '[%EndOfCurrentDay%]'

For the 2nd part of your query.


This will almost never lead to a result because a datetime is an exact moment in time including milliseconds. You could use the token BeginOfCurrentDay and check if it's bigger than that and smaller than BeginOfCurrentDay + DayLength. Also see the available tokens in the XPath documentation, you can also use these in OQL. Check https://world.mendix.com/display/refguide3/XPath+Keywords+and+System+Variables



FROM B.Border AS Object....

And where clause

 WHERE Object[daterec > '[%BeginOfCurrentDay%]' AND daterec < '[%BeginOfCurrentDay%]' + '[%DayLength%]']

however i get a error: "no viable alternative at input "[" " i use an exaple from the XPath article. Why do i get this error?


I hope i understand you correctly but:

WHERE Object[daterec  > '[%BeginOfCurrentDay%]' AND daterec IN $DateRange <= '[%EndOfCurrentDay%]' ]

has the same result. I don't understand even if i copy a exaple exactly (with my vars) i keep on getting the errors.