Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Analysis Server and Reporting Services (2005)
 Multi-Select Report

Author  Topic 

jamie_pattison
Yak Posting Veteran

65 Posts

Posted - 2008-10-07 : 05:40:13
How could i create a multi-select report where the report has one parameter and allows the user to select two values from it?

Thanks

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-10-07 : 05:52:34
just make the parameter as multiselect. And use a table valued UDF to parse the comma seperated parameter values selected by the user and join on to the table udf to fileter your results based on selection.

one such parsing function is given below

CREATE FUNCTION ParseValues  
(@String varchar(8000),
@Delimiter varchar(2)
)
RETURNS @RESULTS TABLE
(ID int identity(1,1),
Val varchar(1000)
)
AS
BEGIN
DECLARE @Value varchar(100)

WHILE @String is not null
BEGIN
SELECT @Value=CASE WHEN CHARINDEX(@Delimiter,@String) >0 THEN LEFT(@String,CHARINDEX(@Delimiter,@String)-1) ELSE @String END,
@String=CASE WHEN CHARINDEX(@Delimiter,@String) >0 THEN SUBSTRING(@String,CHARINDEX(@Delimiter,@String)+1,LEN(@String)) ELSE NULL END
INSERT INTO @RESULTS (Val)
SELECT @Value
END
RETURN
END
Go to Top of Page
   

- Advertisement -