Last post Mar 20, 2012 11:20 AM by Ashutosh Pathak
Mar 19, 2012 06:08 PM|vishvishvish|LINK
I have a matrix in a SSRS report. I want to make a column hide based on after seeing there is no data inside it. Thing is, its value is set from a expression like
= 0 ),1
(min(Fields!TotalPatientDays.Value) > 0 ),min(Fields!TotalPatientDays.Value)
I dont know if its possible or not, can i hide tje column with a expression where i can say If(textbox.value = null or '' or 0 then hide the column.
Please help ..
Mar 20, 2012 12:09 AM|Ashutosh Pathak|LINK
Yes it is possible. It you click on the group and edit its properties under the Visibility tab you can the visibility using an expression. For example I have a report that has a detail group and a valuetype group and I would like to only show value groups
that have data in them.
I do that by setting the visibility expression for the group to the following:
=CountDistinct(Fields!ValueType.Value,"matrix1_Detail")=1 OR Max(Abs(code.GetValue(Fields!Value)))=0
When the expression code evaluates to true the column is hidden.
for normal column hiding do the things below:
Mar 20, 2012 10:42 AM|vishvishvish|LINK
Hi Ashutosh. Thanks for the reply. My concern is , I am not setting the value in the group from any field. I am setting the value from a switch as i put the code in my above message. And your solution willl require the field to count if there is any data.
I am stuck here at this point. Please tell if i am thinking wrong . Thanks
Mar 20, 2012 11:20 AM|Ashutosh Pathak|LINK
in such case if you are not doing something like grouping and all then why dont you use Tablix instead of Matrix, and also you should be hiding the column values not the column, coz whatever the condition returns true your whole column will get visibled
or hide based on first result.
yes you can hide the same using switch or using IIF statements, I've uploaded a sample project in path below that uses AdventureWorks as a database, you just change the connection string of your sql server where AdventureWorks is there.