To use a DateTimeRange in a comparison, use the IN
operator. Mendix will automatically use the correct upper and/or lower bounds restrictions, depending on which of the 'from' and 'to' fields the user selects (so, to create your "Attr. >= Param." restriction, select a 'from' date and leave the 'to' date empty).
As to comparing a String attribute to an enumeration parameter, I'm not sure why you'd want this, but perhaps you can use the CAST
function to get the result you want.
Here's an example showing the use of both IN
and CAST
:
SELECT
user/Name AS UserName,
user/LastLogin AS LastLogin
FROM
System.User AS user
WHERE
user/LastLogin IN $dateRange AND
user/Name = CAST($enumParam AS STRING)
There is a further problem with OQL dates. I believe the time part of the date is set to zero hours, zero minutes.
Both snippets of code below have the same issue: ... AND devs.ContractDate IN $datetest
... and devs.ContractDate >= RANGEBEGIN($datetest) AND devs.ContractDate <= RANGEEND($datetest)
The RangeEnd ($dateTest) is set to the start of day, so any data with dates equal to $dateTest are not extracted because the time part of devs.ContractDate is greater than the time part of RANGEEND($datetest).
As OQL does not allow date calculations to add 1 day, there is not a way of making the OQL work, except to tell the users to set the end date as 1 day later (which is not user frinedly).