Using Variables
Posted: Mon Jan 27, 2014 9:20 pm
I've defined a report with the following datasource
And setting the variable as follows:
But receiving the exception: "An expression of non-boolean type specified in a context where a condition is expected, near 'vConsignment'." What am I doing wrong???
Code: Select all
SELECT TransDate,
SiteID,
Item,
ItemClass,
Description1,
TypeDescription,
CostSum,
QtySum
FROM TRANSDay (nolock)
WHERE (TypeDescription IN ('ADJUS', 'CANCL', 'COUNT', 'ISSRT', 'ISSUE', 'RETN', 'RETNW', 'SCRAP', 'SCRPR'))
AND (Transdate >= @pFromDate AND TransDate < @pToDate)
AND (ItemClass = @pItemClass)
AND (SiteID = @pSiteID)
AND vConsignment
Code: Select all
switch (r.Consignment)
{
case 0:
report.Dictionary.Variables.Add("vConsignment", " (1=1 or Consignment =1)");
break;
case 1:
report.Dictionary.Variables.Add("vConsignment", " (Consignment = 1)");
break;
case 2:
report.Dictionary.Variables.Add("vConsignment", " (Consignment is null or consignment = 0)");
break;
default:
break;
}