SSRS question
Please check out this image: http://imageupload.org/?d=37AFD7001 I have four parameters @ARK (first dropdown),@CHARVAL(second dropdown),@param_ark and @ark_desc..out of which @ARK and @CHARVAL are multi-valued attributes and @param_ark(first textbox),@ark_desc(second textbox) can be null..so the requirement is.. 1)if @param_ark is not null then find the records whose ark id matches with @param_ark 2)if @ark_desc is not null then find the records whose description matches with @ark_desc 3)else if both @param_ark,@ark_desc are null then find the records whose ark id matches @ARK and characteristic value matches @CHARVAL Can somebody please tell me what should be my dataset query for this requirement?
June 30th, 2011 3:02pm

ANY HELP GUYS.. :-|
Free Windows Admin Tool Kit Click here and download it now
July 1st, 2011 2:54pm

you can use IF @param_ark is not null Begin End Else IF @ark_desc is not null Begin End Else IF @ark_desc is null and @param_ark is null Begin End and one question what if @ark_desc is not null and @param_ark is not null
July 2nd, 2011 12:19am

Hi, You can achieve it below is the sample format query which give you an idea on the implementation. DECLARE @Tab TABLE (Id NVARCHAR(10), Val NVARCHAR(10)) INSERT INTO @Tab SELECT 1,1 UNION SELECT 2,2 UNION SELECT 3,3 UNION SELECT 4,4 UNION SELECT 5,5 UNION SELECT 6,6 UNION SELECT 7,7 UNION SELECT 8,8 UNION SELECT 9,9 DECLARE @Para1 NVARCHAR(20) DECLARE @ParaNull1 NVARCHAR(20) DECLARE @Para2 NVARCHAR(20) DECLARE @ParaNull2 NVARCHAR(20) SET @Para1 = '1,2,3,4' SET @Para2 = '2,3,4' SET @ParaNull1 = '2,4,6,8' SET @ParaNull2 = NULL SELECT @Para1, @Para2, @ParaNull1, @ParaNull2 SELECT * FROM @Tab WHERE ',' + CASE WHEN @ParaNull1 IS NOT NULL AND @ParaNull2 IS NULL THEN @ParaNull1 ELSE NULL END + ',' LIKE '%,' + Id + ',%' OR ',' + CASE WHEN @ParaNull2 IS NOT NULL AND @ParaNull1 IS NULL THEN @ParaNull2 ELSE NULL END + ',' LIKE '%,' + Val + ',%' OR ((',' + CASE WHEN @ParaNull1 IS NULL AND @ParaNull1 IS NULL THEN @Para1 ELSE NULL END + ',' LIKE '%,' + Id + ',%') AND (',' + CASE WHEN @ParaNull1 IS NULL AND @ParaNull1 IS NULL THEN @Para2 ELSE NULL END + ',' LIKE '%,' + Val + ',%')) Hope its clear & helpful.... Pavan Kokkula Tata Consultancy Services.
Free Windows Admin Tool Kit Click here and download it now
July 2nd, 2011 7:31am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics