How can i hide a Column group when I use pagebreak - reporting-services

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.

Related

Is there any way to hide the very first label row of a tablix in SSRS?

Is there any way yo hide the part of the tablix that tells you what the column names are and only shows the numbers?
So in this table, hiding the first row with all the text and only having the second row with all the numbers.
It’s pretty straightforward, as you do not have any condition to hide and show column headers you simply wish to hide them. Try below settings will help you
Right click on the row where column name is printed
2. select row visibility
3. click on 'hide row'
That’s it, it will hide column.
Below link for reference.
https://learn.microsoft.com/en-us/sql/reporting-services/report-builder/hide-an-item-report-builder-and-ssrs?view=sql-server-2017
Now if you wish to hide based on some condition try below settings.
Right click on the row where customer name is printed
2. select row visibility
3. click on 'show or hide based on expression'
4. click on expression button and enter your expression
=iif(count(Fields!TranNumber.Value,"Customer")=0,true,false)
Note : In the above expression, replace the "Customer" with the name of your group.
You can go to the Tablix's Properties and in the Grouping section, select Advanced. Under Row Groups, select the first Static row. The Tablix Member should be in the Properties window and set the Hidden Field to True.

SSRS expression based on visibility of a textbox or column

Is it possible to inspect the visibility (Collapsed/Expanded) of a textbox in SSRS and use this in an expression?
For example :
=iif(Fields!column1 Is Visible,"Use this label","Use this other label")
What I want to accomplish to have the initial value of a column header display some text, when user clicks a particular value the details row are displayed (this is a Tablix), and then the header would change to something else (E.g. initial report state is to hide detail rows and only show Tablix member totals so column displays "... total", when user expands to view details column header changes to "... number".
In MS Access through VBA I could inspect the visible property and create code based on this. Till now haven't found a similar way of doing this in SSRS 2016.
Tried setting expressions for visibility as well as setting expressions for changing value of a textbox.
=IIF(Fields!accountnum.Value IS NOTHING OR Fields!accountnum.Value = TRUE,"Station #", "Station Count")
No error messages. My results should be to change header (textbox) value based on whether detail rows are collapsed (hidden) or expanded (visible).
To answer your first question:
Well of course this is possible, just not they way you want to do it. Here is a smimple example. Lets say your visibilty criteria is the following expression:
'Visibility expression
=IIF(Fields!Category.Value = "Visible", False, True)
Now you dont check on the visibilty with the Is Visible criteria, you just use the same expression again. Like this:
=IIF(
IIF(Fields!Category.Value = "Visible",
Fale,
True) = True,
"This one is not visible",
"This one is visible")
To answer you problem:
They way you want to do it, it is not possible. But you can do this with a workaround.
Add a user defined parameter to your report with two options:
Display details
Hide details
Then add two tablixes to your report. One tablix without the details and one tablix with the details you want to show.
Then go to the first tablix Tablix Properties > Visibility and add the following expression:
=IIF(Parameters!VisibilityParameter.Value = "Display details", True, False)
And the expression for the other tablix visibility:
=IIF(Parameters!VisibilityParameter.Value = "Hide details", True, False)
Now based on the parameter result the talbix with or without the details will be displayed.
You can do this, maybe it won't look too elegant but I'll show you what I did and you can see if it's useful.
Note: Using this method, you can't change the actual column header directly as it's out of scope so this may not meet requirements but you may be able to adapt it. I just thought it was a nice challenge ! :)
First I got some sample data (WideWorldImports sample database) that just gave me a CountryID, CountryName and Continent.
Once you have your data, add a table, drag CountryName into the first column and remove the remaining two columns.
Then right-click the Details row group and do Add Group => Parent Group Choose Continent as the Group By field and check the Add Group Header option.
The table design should look like this, nice and simple.
Next we will set the toggle on the detail rows. Right-Click the "Details" row group and chose "Group Properties". On visibility, click 'Hide' and check the "Display Can be toggled by the report item" to Continent.
We should now have a report that expands and collapses as expected.
Next vertically expand the 'blank cell' just above the countryname as we'll need a bit of room to work with. Make it about 4 times the normal height, we'll change it back later so the size is not important.
In the blank cell, right-click and do Insert => Rectangle.
In this rectangle, right-click and do Insert => TextBox. Double click the text box and type your "collapsed state" column header caption. In my example I just used "Collapsed Header".
Repeat and add another textbox (It must be within the rectangle again). Set this text box to your "expanded state" caption. In this example I just used "Expanded Header".
Next, right click the "Collapsed header" textbox, then properties then set the visibility to Show and the toggle item to Continent.
Repeat for your "Expanded Header" but this time set visibilty to Hide, like this..
Finally, position both text boxes at location 0,0 so they overlap and shrink the cell back down to it's original size.
The final design will look something like this...
When we first run the report we see this.
If we expand a node, we get this.
I do not think this is possible in SSRS. You could change column header text depending on your condition, For Ex: IF (A) then Header A else Header B. But you wish to change Column Header based on some clicks (expand / collapse) on report and this is not possible. I mean we need some data to set condition not clicks.
But maybe someone with more Experience on SSRS would throw some more insight.
This is what InScope() is for. See here for more information

Get Value from table when page break

I put a table and a textbox in the body area.
There are three columns in the talble, ItemType, ItemId, ItemName
Page breaks when ItemType changed.
The expression of the textbox is "=First(Fields!ItemType.Value, "DataSet1")".
Set RepeatWith property to "Talix1".
When Report runs, in the 1st page, the value of the textbox is "Green" .
but 2nd page the value is still "Green". In fact I want to see "Red"
What should I do to change the value when page breaks?
thank you for your help.
Report Design Result
Because the text-box is currently outside of any data-set context, the value will not change. The expression is grabbing the first value in the data-set each time. Changing the page will not change the first value in the data-set.
You are going to have to put your text-box, and table, inside a List. Once that is done, set the group properties of the List to group, and page break, based on item type (ItemType). You can set these from the context menu you get when you right-click the Details for the List in the Row Groups pane, and choose Group Properties.
You can remove the grouping from the table since the List will handle that now.
By doing this, you now have your text-box in a data-set context. The expression for the value of the text-box can be changed to something like the following.
=First(Fields!ItemType.Value)
The scope is no longer needed since that too is set by the List.
Hope this helps you out.

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

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.

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.