I am creating a report based on start_date and end_date.
To get the dates, I used startInputDate and endInputDate, each in a Date and Time picker in Perspective.
For testing, in the report header I used
Start Date: @start_date@
End Date: @end_date@
When I return to the report, N/A appears in these fields (because they are passed within the Report Viewer). And when I go to the report view, these dates appear correct. In other words, the logic of getting the dates is correct (I am getting the formattedValue field).
Back to the Report Designer.
I use a SQL Query, which returns 10 columns from a table.
If I use
DECLARE @startDateTime DATETIME = TRY_CONVERT(DATETIME, '08/01/24 12:00:00 AM', 1);
DECLARE @endDateTime DATETIME = TRY_CONVERT(DATETIME, '08/02/24 12:00:00 AM', 1);
The query runs correctly, and I can work by assembling the table within Report Design.
But if I use
DECLARE @startDateTime DATETIME = TRY_CONVERT(DATETIME, @start_date@, 1);
DECLARE @endDateTime DATETIME = TRY_CONVERT(DATETIME, @end_date@, 1);
A query error appears (since start_date and end_date are data from the Report Viewer) and when you return to the Report Viewer, the data is not obtained.
I have also tried
DECLARE @startDateTime DATETIME = TRY_CONVERT(DATETIME, ?, 1);
DECLARE @endDateTime DATETIME = TRY_CONVERT(DATETIME, ?, 1);
In the parameters, put
{start_date}
{end_date}
But none of them have been successful yet.
I would be very grateful for any tips to improve the logic or get around this error.