how do I hide parent row when child rows expanded? - reporting-services

I have a data set that consists of the gross dollar amount on row 1, 1-n number of rows of various details then a last row that shows the gross dollars minus the various row amounts. I am trying to replicate some expand/collapse functionality used in an internal ASP report page where the initial row is the NET value (collapsed). When expanded, the gross, detail, and net rows show up in a "expand up" action.
I have been able to so far get the parent row to show the NET values when collapsed, but I am trying to find a way to hide the contents of the parent row once expanded so that the NET values are not displayed twice.
Is there some kind of "is hidden" property I can use in an expression to hide the data in the cells? not sure how else I can accomplish this. Any help would be appreciated.
thanks!

The only thing I can think of that might help is inscope(). You can use something along the lines of:
iif(inscope("ChildGroup") = TRUE ...
This will test to see if the current item is within the scope of the grouping, which means that you can test if the current group is expanded or collapsed.
See https://technet.microsoft.com/en-us/library/ms156490(v=sql.100).aspx for more information on inscope().

so after much research it appears this cannot be done thanks to SSRS producing a static report once rendered. The inscope function allowed me to set the initial state of the row, but does not give functionality to update report properties after rendering occurs. my only options would be then to create a second parent group (grand parent?) or insert an action that calls the report over again passing in a hidden parameter.
thank you for your help!

I believe you can do this, but you'll need to make some adjustments.
A. You can't put your gross dollar amount in the row you'll be using to expand/collapse.
B. Don't use group visibility to expand/collapse. You'll need to use row visibility. (This can get tricky and I don't recommend it if you have nested groups. It becomes unmanageable.)
Row 1: Toggle
Row 2: Gross Dollar Amount, default visible
Row 3-n: Various row Dollar Amounts, default hidden;
Set rows 2-n to toggle based on Row 1.
When you the report initially renders, Row 2 will be visible, Row 3n are not. When you toggle, Row 2 will hide, row 3n will be visible.

Related

Hiding a row if text box is hidden

I have a report that lists parts required for a job, and then within each part it has rows that show locations and quantities of parts on-hand. The main list has a header (part number, description, quantity) which is only shown once at the top because it is not within the grouping. However, the second header (on-hand quantity, location) is within the grouping so it repeats. I would like it to only show once.
I have tried using the hide duplicates property for the header text boxes, but this still leaves blank rows. I have also tried setting the row visibility using a comparison between ReportItem!lblOnHand.Value and Previous(ReportItem!lblOnHand.Value) but this gives me an aggregate error.
This is what the report is displaying now:
You need to set the row visibility rather than the individual text boxes. Right-click the row header to access the setting..
You should (untested) be able to use the same logic as you have now. If this does not work then you will need to test if the group is the first group and use that in the expression, something like...
=Fields!Partnumber.Value <> FIRST(Fields!Partnumber.Value, "myGroupOrDatasetNameHere")
The above would hide thew row if the part number in the current context is not the same as the first part number in the group or dataset name specified.

SSRS: Position Matrix Cell at Intermediate Column Grouping Level, and also inside a Row Group

I have an SSRS matrix that has one level of row groups and two levels of column groups. I have a textbox that is positioned inside one of the column groups, and outside of the other one, which is what I want. But I also want this textbox to be positioned inside of a row group.
Basically, I would like #1 in the screenshot below to have a row group associated with it so that #2 is inside that row group.
My goal is to conditionally set the row-visibility for the first row. But "row visibility..." is greyed out. As far as I can tell, the way to get the option is to make sure it's inside of a row group.
The reason I want to set visibility is because the user has the option to show or hide charts, and separately to show or hide data. If the user selects both charts and data, then I don't need the first row because the label for the data can describe the chart as well. But if the user only selects charts, then I need that first row.
If there's another approach outside of minimizing the row height, I'm all ears.
Though I'm still interested in whether this puzzle is even solvable, and if not, why not.
Steps to Repeat
A version of this problem can be repeated as follows:
Insert a new matrix in a report
Just fill in dummy values, such as a blank space, into the "RowGroup1" and "ColumnGroup" "Group On" expressions.
Add a parent group to the column group, and similarly just give it a dummy grouping expression.
Delete the second row of the matrix, via "Delete Rows Only"
You now have a matrix with the same problem. Namely, get the second cell of the first row, to be inside of a row grouping.

Displaying page number in body of RDLC

How do I get Page Number in Body Section of RDLC report. Globals!PageNumber can be used only inside either Report Header or Footer. What if I put Row number to my dataset and get the record number.
Limiting the number of records per page and do the visibility calculation based on the records number is the best solution so far that I've heard of.
Can anyone educate me on this logic?
Or is there any other workaround for this?
P.S:
Other so-called solution like using Custom code is not giving you the correct page number. It will always show 1.
There isn't really an easier way to get the page number in the body. I think working with the dataset row count is the only reliable way.
What I have here is a short SQL statement to get Project Status information:
SELECT * FROM PROJ_STATUS
So I'll add the row number as a field, and also divide it by the number of records I want per page and add 1 (giving me the page number of each row)
SELECT * , ((DENSE_RANK() OVER(ORDER BY PRS_ID) -1) / 3 ) +1 AS [CountRow] FROM PROJ_STATUS
Now in my report I've got a table showing the status names and if they are active or not... I'll also add the page number as a column.
Next put a list in the report and put the table inside it.
Then click the top left square corner on the list and in the properties window set the dataset to the one you are using.
Then right click on the row group in the list and set the grouping to the page number column.
And put page breaks in between instances.
And there you go!
Reason why the -1 for #4Star. See that without the -1 the 3rd row is on the second page.
If your dataset is a row per whatever you want to get page numbers for, then
=RowNumber("DataSet1")
will work.
This is the same as using
row_number() over (order by (select null))
as it gives you an arbitrary ordering for row numbers.

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.

group devider in reporting service report

My SSRS report is using groups to divide the data in group. I would like to have a line separator at the last row of the group. I did hide the group footer and header since it gives me an extra row when render the report to excel, So the bordering of group header or footer for this is not working. I wanted to avoid the extra rows in excel. Is there any other way I can try to get this done?
Probably the most powerful thing about Reporting Services is the ability to use expressions for any object property. Couple this with the out-of-the-box Previous function which allows you to access the previous value of a field and you have a solution.
Select the entire Detail row. Expand the BorderStyle property and enter the following code for the Top property (assuming we want a line separating all the departments):
=IIF(Previous(Fields!Department.Value) <> Fields!Department.Value, "Solid", "None")
This compares the previous value of the Department field with the current value and if they are different, it makes the Top border of this detail row to be Solid.
While this puts a line at the top row of next group rather than the bottom row of the previous group, it is visually and functionally equivalent to what you are after with the benefit of being really easy to implement.