Hello All,
I've built 100's of Reports using the Telerik tools but I've never used a SQL query where I've used a DECLARE function for the data source.
Here is my query:
DECLARE @CaseNum as NVARCHAR(12) = '20604003'
DECLARE @Enc as INTEGER = '743212'
DECLARE @START_Date as DateTime ='2024-10-08 00:00:00.000'
DECLARE @Enc_Date as DateTime= '2024-10-17 00:00:00.000'
DECLARE @Location as NVARCHAR(75)= 'SHOULDER/ARM'
SET @Location = (SELECT Location FROM tblVisitLog WHERE Encounter_code = @Enc AND CaseNumber = @CaseNum AND Discipline = 'PT' AND VisitType <> 'M')
SET @START_Date = (SELECT TOP 1 TimeIN
FROM tblVisitLog
WHERE Encounter_code = (SELECT MIN(Encounter_code) FROM tblVisitLog WHERE CaseNumber = @CaseNum AND Discipline = 'PT' AND VisitType <> 'M' AND TimeIN > '2014-12-31 00:00:000' AND Location = @Location) AND CaseNumber = @CaseNum
AND Discipline = 'PT' AND VisitType <> 'M')
SET @Enc_Date = (SELECT TimeIn FROM tblVisitLog WHERE Encounter_code = @Enc AND CaseNumber = @CaseNum AND Discipline = 'PT' AND VisitType <> 'M')
SELECT COUNT(Encounter_code)
FROM tblVisitLog
WHERE CaseNumber = @CaseNum AND TimeIN BETWEEN @START_Date AND @Enc_Date AND Discipline = 'PT'AND VisitType <> 'M' AND Location = @Location
This works great in SQL Server, but this is throwing the following error when used as the Report Source: for this sub-report.
Invalid value of report parameter 'Location'.
I've ran this report specifying the values (shown here) in my SQL and using the Parameter.Location.Value on the Configuring data source parameters page. I've left them blank and specified the values on the Configure Design Time Parameters, in other words I've tried many many things.
I need help with this. Thank you,
Jack