This topic is locked
[SOLVED]

Casting a date gives me not the right search criteria in "Advanced search"

11/12/2021 12:53:35 PM
ASPRunner.NET Tips and tricks
H
houseofit author

Hi.

I have a table with some transactions and I sum them up on days with :

SELECT
SUM(amount) AS [Sum],
CAST(itemdate as date) AS [Dato]
FROM dbo.transactions
GROUP BY CAST(itemdate as date)

works great and the report I get from ASP runner is fine, but when I press Advanced search and want to type in a search interval for the dates it doesn't give me the calender option to select the dates from so my conclusion is that ASP runner thinks that the "GROUP" values are strings.

If I don't use the group thing I get the right search option and can search on a specific interval.

Any ideas ? Hop my question make sense....

H
houseofit author 11/12/2021

Found the way to do it.

Don't use Group By in the SQL but let ASP runner do the Group BY, and then it is important in the Group Field not the set the Interval to "Normal". This will give a runtime error...