Friday 27 June 2014

ssrs show hide column based on expression


I have two columns and column name ename,epname
my requirement will be if all the rows has same value of ename=epname than I dont want to display two columns
if any one of the row value is not equal i.e ename<>epname than I want to dispay these two columns
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[empdetails]') AND type in (N'U')) DROP TABLE [dbo].[empdetails] GO
CREATE TABLE [dbo].[empdetails]( [eid] [int] IDENTITY(1,1) NOT NULL, [ename] [varchar](20) NULL, [epname] [varchar](20) NULL)
GO
INSERT INTO empdetails values('ra','ra')
GO
INSERT INTO empdetails values('ra','rag') GO
select * from empdetails
Create a dataset in ssrs report and drag all columnn in table
go to column visibilty set column visibility
show or hide based on an expression
set expression "=iif(sum(iif(Fields!ename.Value<>Fields!epname.Value,1,0),"DataSet1")>0,false,true)"
where "DataSet1" your dataset name

No comments:

Post a Comment