Friday, March 30, 2012

Multi value in Report Parameter using MSVS Report Designer.

Hi All,

I have a question, How to user the Multi value in Visual Studio Report Designer.

My dataset contains the following

Select empno,empname,basicpay,deptcd from employee where deptcd in (substring(@.gdept,1,4))

Here variable gdept is the report parameter. I am passing the value.
it works fine with single value.

( the source of gdept is a another dataset to list the deparment code+name,

Example

DEP1 - COMPUTER

DEP2 - ADMIN

DEP3 - FINANCE

)

when I preview, i have a combo box to select the department.

If I choose one deparment, it works fine.

If I choose more than one department or select all I have error message

"substring function requires 3 aruguments."

what is wrong is the query

Please advise.

Cheers,

Saleem

Thats nor possible within a single query. By choosing more than one Value it will evaluate to SUBSTR('A','B',1,4) which is not valid, because the signature of SUBSTRING Only allows 3 parameters. You will have to do that with splitting the values. I once wrote a function for that which will make those values Accessible for you as a table and which can be joined easily afterwards.

See more details on: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=320221&SiteID=1

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

No comments:

Post a Comment