Hide multiple rows or columns in SSRS report with same Expression at same time - reporting-services

I have a report containing a Tablix/table with sets of rows and columns which I am hiding conditionally using Expressions, via the Column/Row Visibility dialog.
If for example I have 3 columns which I want to all have the same Expression to determine their visibility, is there any way for me to achieve this without opening the Column Visibility dialog for each Column and entering the appropriate Expression?
I've tried selecting multiple columns, but then the right-click context menu no longer offers the Column Visibility option (it's greyed out) and I have also tried out the Hidden property of the columns (which can be amended in bulk by selecting multiple columns), but this only stops the columns from being rendered, leaving a blank space where they used to be (rather than how Column Visibility works, where columns to the right of the hidden columns are moved across to fill the gap, like hiding columns in an Excel sheet).
Is it possible to achieve what I'm after, or will I have to continue opening the Column/Row Visibility dialog for each column/row I wish to conditionally hide/show?

If the columns you want to control the visibility for are next to each other, you can create a Column Group for them and manage the visibility via the Group.
Add a new column group at the appropriate level so that only the relevant columns will be included.
If you already have Column Groups this will likely be a Child Group or an Adjacent Group.
If not, you can create an initial Column Group by dragging a Dataset field from the Report Data into the Groups pane.
Insert new columns inside the new group, and move the data from your existing relevant columns into the group.
The new group does not need to repeat, so in it's properties window set Group on: to a plain text value, e.g. "1".
Input the desired visibility settings into the Visibility page of the properties window.
For each of the individual columns inside the group set the Hidden property to False, to remove any other expressions or settings that might interfere.

Not exactly what you are looking for but perhaps a midway point - and this can apply to many things other than visibility (e.g. background colour, tooltip) - edit the RDL directly using View Code. This has the added benefit of being able to implement changes that are almost identical per column instead of identical with a minimum of mouse usage.
Typically I have set one column up the way I like it in the designer and then copy/paste under the other columns. In the case of visibility look for <TablixColumnHierarchy><TablixMemebers>. You will see a list of empty <TablixMember /> items along with the expanded <TablixMember><Visibility><Hidden>=... block where you have set up one column. Simply copy paste that block over the empty items at the position of interest (you will need to count it out unfortunately as there are no identifiers).
Bonus Tip: If you make a mistake or want to change something later, you can do a replace on all expressions at once (optional regex allowed).
Remember to backup or check in your work first because the designer may not open that report again correctly if you make a mistake :-)

Select the columns you want to conditionally hide and press F4 to see the Properties Window. Look for the Visibility node and use the Hidden property to set the conditionally expression.
The expression should evaluate to True for hiding and False for showing.
Let me know if this helps.

Related

How would you dynamically hide or display a SSRS header based on a parameter?

I need to hide or display the header of a SSRS report based on the value of a parameter. The parameter is called "Show Header?", and the values of this parameter are true and false. Is there a hide property for headers? If so, I'm not able to find it.
I'm not sure if you are talking about the table Headers or the report header (some people seem to use the term interchangeably).
I'm still self learning SSRS so there may be better options out there but a quick test i found the following.
For a Boolean Parameter type:
I used the logic below to hide the visibility based on parameter (you may want to play around with the true/false order depending on your parameter to get it to work how you want):
=IIF(Parameters!ShowHeader.Value, False,True)
Table Headers:
Just highlight the text boxes you want to show/hide and open up the properties, under Visibility select "Show or Hide Based on Expression"
(NB. i found highlighting the full row would only let you select the full tablix properties not the single row so I just shift clicked all the cells and pasted the IIF statement into the "Hidden" Property for the selection in the properties window)
Report Headers:
I am not sure you can hide the Header (couldn't see any immediate hiding properties or options), however you could hide the contents of the header using the same sort of process (right click properties and alter the Visibility setting or add the code into the Hidden property). In testing I found that the header would reduce to remove white space when items where hidden so may work out for you.
The sneaky way I've found to get around the limitation of SSRS on this is to put my "header" in the first row of the first tablix and just hiding the actual report header, which you probably know cannot be deleted. That way, I can show or hide the first row of the tablix by whatever criteria I desire. This method works well for me.

Combining Cells in Locally Rendered Microsoft Report

I have a basic Tablix in my report that currently renders as follows:
These are steps in a manufacturing process with the clock number of the person who performed them with date performed in the last two columns. However, sometimes steps are combined and performed together. In the example above, steps 10-20 are performed together, and 30-40 are performed together. So I would really like the report to be rendered like this:
I do have a column in my data called "StepRange" which in the above example would be "10-20" for the first two rows and "30-40" for the third and fourth rows. So when the value of StepRange is alike, I know those rows are performed together and henceforth the last two columns should be combined. My example shows only two rows being combined at a time, but it could be any number.
How can I make my report look like the second example above instead of the first?
Single Tablix Method
Rather than literal conditional merging, you can set the border style of a textbox using an expression to achieve a similar effect. There are a few steps, but none of them are particularly involved.
Create a parent group for StepRange. Do not add a header or footer, and delete the added column without removing the group.
Make sure that your properties panel is visible on the right of your screen. If not, check the "Properties" checkbox under the View ribbon.
Click on your first detail TextBox and expand the "BorderStyle" property. Set the "Top" property to the following expression:
=IIF(RunningValue(Field!Step.Value,CountDistinct,"StepRange")>1, "None", "Solid")
Set the Bottom property to "None".
Set the expression of the detail TextBox itself.
Replace FIELDNAME with the appropriate field:
=IIF(RunningValue(Field!Step.Value,CountDistinct,"StepRange")>1, "", Field!FIELDNAME.Value)
Repeat this process for each detail TextBox.
You may need to create a dummy row at the bottom with a black top border if you do not have a summation row. (optional)
The expression only evaluates to "Solid" for the first Step value within each StepRange group, so subsequent rows do not have a top border and appear undivided.
Nested Tablix Method
Using a nested Tablix is more straightforward. I have had some issues with them, including some rendering hiccups. But in a report this simple that may not be an issue at all.
Set up your main Tablix to group on StepRange.
Either clear or add a column to the left for the individual steps.
Select "Insert Table" from the toolbar and click on the empty cell.
Set the cells to your step and operation fields and delete the extra column.
The result should look roughly like this:
By default the inner Tablix will be detail grouped. If your detail rows are more granular than the "Step" field, go to the properties of the "(Detail)" group and add a Group Expression for Step.
You can also delete the inner header row if you don't want to see it repeated in the report.
This results in the employee fields actually being merged and spacing properly. If you don't use an aggregate function on those fields, their value will be that of the first row returned internally. Which is moot if their values are uniform across steps.

How can i hide a Column group when I use pagebreak

I have made a matrix report in SSRS with two column groups. I have added one of the column group also in the Row groups to use page break so I can have each column group on a separate page.
And you see in the following pictures the preview of what has happened with the output.
Page One
Page Two
You see that the page break has worked but it doesn’t hide the other column that shouldn’t be present.
Does somebody has a clue how to fix this?
I don't think just adding a page break will hide the column group's visibility. In SSRS, you can set visibility of a column group based on a condition. Right click on the column group, select Group Properties, Select "Visibility", and "Show and Hide Based on Expression".
You could set an expression based on a field or parameter value. For example, if a parameter value is such, the visibility is true, else false. Example:
=IIF(Parameters!"PARAMNAME".Value.Equals(value),false,true)
I would think in your case, if some a field was null or blank, hide the column group. The page break will take care of itself.
I have solved it with the list object in the toolbox.
I have put the matrix in the list and used a page break on the list.

Labels in fields within an SSRS report

I am attempting to reproduce a form within SSRS and fill it with data. The original form has blocks with small labels inside of each box that identifies the entry requested.
I "thought" I could simply use two different tablixes: one for the blocks with borders and labels, and the other one with the actual datafields or expressions, and align the 2nd tablix directly over the first one so that it appears as though the fields are presenting data inside of the labeled boxes.
It looked as I wanted it in design view, but when I went to preview the report, it pushed the 2nd tablix below the first tablix, in effect creating two tablixes, one stacked on top of the other one (not displaying as how I intended).
So, how do I accomplish the form design in the manner that I am seeking?
You should be using a type other than tablix for your report. Use a 'List' instead and you can free float objects as you need them and also nest a tablix as well. A little explanation on list:
You can float images with text boxes and then even change syntax or draw boxes around them and decorate those.
The call out for a field in SSRS is [(value)] with the [] meaning: "Data Column in recognized Dataset"
You can call out Variables with an '#' in front of them [#Test] would be a variable a user would put in called 'Test'.
Whatever size 'List' element is will determine how large it is when it repeats. If you want a strict form ensure the length and width are set correctly on the properties of that element.
If you want it to break every page you can click on the 'List' > Right Click the top left corner > Properties > 'Add a page break before' checkbox.
My example shows a super simple textbox with a dataset that only has three ideas repeat as many times as there are id's, three times. You can apply this to your form as needed.
It looks like you could reproduce that form header quite easily with a single tablix. If you envisage the form as a set of tablix cells like so:
then all you need to do is set the Border properties for each cell to hide the borders as needed (or you could merge the cells e.g those for Applicant and Location).
You can use a tablix with only Header rows, deleting the detail row. If you need multiple forms per report, then put the tablix inside a List region.

How to hide one row in a rowgroup?

I have a report in SSRS 2008 that has the following structure:
List
Tablix
Row Group
Row1
Field
Row2
Subreport
Is it possible to completely hide the first row in the row group, based on some condition?
I can hide the row, but the empty row still takes up space, I want the empty row to take up no space at all.
Part of the answer is given in the discussion that this question links to:
Try to set the Hidden property of the Static Row Group under the Details Group, in this case the whole row will disappear instead of the content of the textboxes.If you are using Report Builder, you need to switch to Advanced Mode (make sure that the Properties and the Grouping windows are displayed, go to the upper right side of the Grouping window and press the black triangle), click on the second "Static" item under the "(Details)" group and you can set the Hidden property on the Properties window.
However, this causes an exception when trying to export the report as PDF.
you can write an expression for the visibility of row.