Dates and Aggregate Records

Dates and Aggregate Records

A simple task: find the latest entry in a database based on an input date.

I have a stateless form with a date field. After entering a date, the aggregate record task would find the latest entry for that date. The issue is that the database uses date-time fields so this fails to work:

max_date = Date_Time[Date_Time_1 == input.Date_1].maximum(Date_Time_1);

Nor can we do this:

max_date = Date_Time[Date_Time_1.toDate() == input.Date_1].maximum(Date_Time_1);

Error in statement at line number 1
Either the left or the right expression in a boolean expression in the criteria has to be a Form/Table Variable

Any ideas?

Cheers,
John Whitney