I'm almost getting the same error message:
The expression for the query âbusâ contains an error: [BC30201] Expression expected.
I'm trying to do a dynamic query in reporting services. The static query works perfectly, but the one below does not. The only change I've made is the highlighted IIF statement.
="SELECT Bus.RNID AS r1, Bus.RNID AS r2, Bus.Name, ESStatus.CreationTime, CAST(ESStatus.CreationTime AS char(12)) AS date, ESStatus.ErrorText
FROM Bus INNER JOIN
ESStatus ON Bus.Id = ESStatus.UnitId
WHERE (ESStatus.CreationTime BETWEEN @startDate AND @EndDate) AND (Bus.RNID = @RNID)
GROUP BY ESStatus.CreationTime, Bus.Name, Bus.RNID, Bus.Id, ESStatus.ErrorText" & IIF(Parameters!ErrorText.Value = 'All', "", " HAVING (ESStatus.ErrorText = N'gps reciever status: failure')") & ""
just for reference I put in the working static code below.
SELECT Bus.RNID, ESStatus.CreationTime, bus.name, CAST(ESStatus.CreationTime AS char(12)) AS date, ESStatus.ErrorText
FROM Bus INNER JOIN
ESStatus ON Bus.Id = ESStatus.UnitId
WHERE (ESStatus.CreationTime BETWEEN @startDate AND @EndDate) AND (Bus.RNID = @RNID)
GROUP BY ESStatus.CreationTime, Bus.Name, Bus.RNID, Bus.Id, ESStatus.ErrorText
HAVING (ESStatus.ErrorText = N'GPS reciever status: failure')
I would really appreciate some help, resolving this problem!!
|