Using Variables

Stimulsoft Reports.WEB discussion
Post Reply
rumblecow
Posts: 33
Joined: Fri Nov 08, 2013 3:47 pm

Using Variables

Post by rumblecow »

I've defined a report with the following datasource

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
And setting the variable as follows:

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;
            }

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???
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Using Variables

Post by Alex K. »

Hello,

Please try to use the following query:

Code: Select all

WHERE  ...
      AND {vConsignment}
Thank you.
Post Reply