jassie
Constraint Violating Yak Guru
332 Posts |
Posted - 2013-12-20 : 09:57:51
|
In an existing SSRS 2008 R2 report, I need to add some extra parameters to several reports that call subreports. There will be times when the parameters may be empty. The visibility of specific columns and report headers will determine if the column or report header will be displayed. If the parameter(s) are empty, null, do not contain anything, I want those columns and report headerts to not display. Can you show me the code that will test to see if a parameter value is null? |
|
cbrammer1219
Starting Member
3 Posts |
Posted - 2013-12-22 : 13:50:15
|
Hi I have tried using the mv_param function and the fn_split function, When I use them it returns everything from that column, my example follows...When executed it returns everything like it is ignoring the function, @Country prints out the right values as set in the param, but the results are 'USA,IRL,AUS,NZL,CAN,JPN' I am at a loss because the function isn't working so it seems. The function code follows the select code....Any help or advise is greatly appreciated.>DECLARE @currYr nvarchar(4)DECLARE @gblCliName nvarchar(65)DECLARE @Country nvarchar(75)SET @currYr ='2013'SET @gblCliName ='Jimmy'SET @Country ='CAN,AUS,IRL'SELECT MONTH_CODE ,AON_COUNTRY ,GLOBAL_CLIENT_NAME ,GLOBAL_CLIENT_DUNS_NUMBER ,LOCAL_CLIENT_CODE ,LOCAL_CLIENT_NAMEFROM AIMS_UDE_POLICY_ROLLUPWHERE GLOBAL_CLIENT_NAME LIKE @gblCliName + '%' AND SUBSTRING(MONTH_CODE, 1, 4) = @currYr AND AON_COUNTRY IN (select AON_COUNTRY from dbo.fnSplit(@Country,',')as string) ---------FunctionALTER FUNCTION [dbo].[fnSplit] ( @string nvarchar(4000) , @delim nvarchar(100) )RETURNS @result TABLE ( [Value] nvarchar(4000) NOT NULL , [Index] int NOT NULL ) ASBEGIN DECLARE @str nvarchar(4000) , @pos int , @prv int = 1 SELECT @pos = CHARINDEX(@delim, @string) WHILE @pos > 0 BEGIN SELECT @str = SUBSTRING(@string, @prv, @pos - @prv) INSERT INTO @result SELECT @str, @prv SELECT @prv = @pos + LEN(@delim) , @pos = CHARINDEX(@delim, @string, @pos + 1) END INSERT INTO @result SELECT SUBSTRING(@string, @prv, 4000), @prv RETURNEND |
|
|