SSRS Subreport disappears after page is changed - reporting-services

I'm using Visual Studio 2019 with SSDT(SQL Server Data Tools) and "Microsoft Reporting Services Projects" to create a SSRS Report. In this Report I have several Subreports to show detail information.
It can happen that one of the subreports shows no additional data. In this case I still want the structure of the Subreport to be shown, like this (table structure with thinner Bordes is the Subreport):
But when I switch to another page and back to this page of the Report, the structure is gone:
This seems to be the case, when there is no information in the Subreport.
There are no visibility properties set, neither in the Subreport nor in the "parent"-Report, so everything should be visible all the time.

Yes it will happen because your sub report does not return anything and hence the blank.
For Testing just try running one of your sub report only (without main report) with parameter which does not return data and you will see your sub report page is completely empty
Now how to solve this issue:
For your sub report:
I would add static table (without datasets) and add it on top of your tablix.
I will add visibility rule to this static table to show only when your datasets does not return data. so that this static is visible only when original subreport data is not available, else you have your subreport data been shown.

This happend because SSRS think should hide the subreport since all the dataset are empty (or the only one you have) so to avoid that in your subreport just add a new dataset with
'select 1 as one'
that will do the job

Related

How can I tell if my SSRS report is running as a subreport?

I have a report. The report has a header. Sometimes, users view my report by itself. Other times, they view it as part of a larger combined report.
The combined report also has a header. So, in 'subreport mode' my report ends up with two headers.
I want to hide the header of the subreport, but only when it is a subreport.
I'm hoping for something like Visible=IsSubreport. Is there a way for my report to tell if it is running as a subreport? Or do I have to add a new parameter and pass it in from the outside, telling it whether it is a subreport or not?
You can add a parameter as isSubReport to you report like this:
And then pass "true" from the Sub report properties menu.

To suppress whole main report when sub report has no data

I have a SSRS 2005 report with 4 sub reports embedded.I have a situation where when all the sub reports have empty data the main report is still getting displayed . The main report has a header with header name coming from main data set,so i am getting only report header with empty page.I am using data driven email subscription to deliver the report.
Is there any way wherein the whole main report can be suppressed when all the sub reports has no data either during report generation stage or while rendering the reports by email subscription or in any other way?
Put the 4 sub reports inside a List container. Tie the list container to a new dataset you create that will return either one row if there is going to be data in the 4 subreports, or no rows if there will be no data. Set the no data returned behavior of the List to whatever you want.

SSRS Object reference not set to an instance of an object

I'm working on a complex SSRS report that contains a number of subreport, with a total of five levels of nested sub-reports. This is a lot, but necessary due to the complicated nature of the top level report.
I've encountered an odd error with the last subreport I've added:
Warning 1 [rsErrorExecutingSubreport] An error occurred while executing the subreport 'ThingRateQuotaWrapper' (Instance: T0R0S0S1T0R0x0S0): Object reference not set to an instance of an object. C:\Users\mmxxxxxxx\Documents\Visual Studio 2012\ThingsReporting\ThingsReporting\Thing 2014 Consolidated Report.rdl 0 0
The problem here is that when I run the second level report (one of the reports contained in the top level "consolidated" report), everything works fine. But in the top level report, I get this unepected error.
The specific subreport mentioned is four levels down from the top report, so I would expected the second level report to fail if there was an issue, however as just mentioned that works perfectly.
In addition, the RDL and line number mentioned in the error message tells me nothing useful.
I've tried everything I can think of to solve this problem, including deleting, saving, re-inserting and configuring all the subreports from the ThingRateQuotaWrapper upwards. At this point I can think of nothing else to try that makes any sense.
How can a report fail because of a sub report four levels down, when other reports in between work correctly?
Anyone got any ideas or tips? I'm using SQL Server 2012 Business Intelligence and Visual Studio Premium 2012.
I've solved this problem, however I don't entirely understand the solution so I welcome any comments which might expand on it.
My approach was to look through each expression in the set of reports and subreports that make up my consolidated report, looking for any that might fail for any reason. I discovered that the visibility expression for the tablix row which contains the ThingRateQuotaWrapper subreport had the dreaded red squiggly line beneath it.
I believe the cause of the field warning is that the visibility expressed used a dataset other than the primary dataset of the tablix. I reworked the tablix dataset to contain the required column to determine visibility of the subreport, then updated the visibility expression to use the new column in the primary dataset. This fixed the problem.
This issue still impact SSRS in Visual Studio 2017 when renaming a sub-report.
Delete all the object in the \bin\ folder and VS will rebuild it without the error.
In my case, sub report's name had been changed (params and everything were correct) just name had been changed. Lead to this error.
This tends to happen when you change the names on reports. I accomplished this by deleting the .data files in my project directory as this stores the cached data of your reports. Then restart visual studios and the problem should be resolved.
In short:
Delete .DATA files in directory
Restart Visual Studios
Hope this helps.
Thanks
Gavin
To anyone coming to this old thread, I had the exact same error message with the following configuration:
Main report (top parent level report) calls 5 sub report hierarchy deep
The sub report is crashing only when generating from the Main report. Everything is fine when calling from each sub report level (all!) including the sub report itself
Pre-requisite explanation
The business wants me to show either a Bar chart OR a textbox on a dedicated condition.
To avoid empty spaces produced by a ReportItem (my subReport outputing a bar chart) that is hidden, I usually put them inside a Tablix and manage the Row visibility. Like that, no empty spaces is generated !
Old structure causing issue
I have one tablix with two rows :
The first one contains my sub report outputting a bar chart
The second one contains a simple TextBox
The tablix's dataset is a dataset containing the Textbox's text value (and that's the key of the problem !)
New structure fixing the issue
I have now 2 tablix :
One tablix with a dummy dataset ("SELECT 1 as 'Dummy') associated to the tablix. This tablix calls the bar chart's sub report
A second tablix with the same dataset as before (containing the Textbox's text value)
UPDATE 29.06.2022
The solution described above worked without RowVisibility condition. As soon as I've added my expression it fails again :
=IIF(RowNumber("myDataSetName")=0, True, False)
Solution: replace by this condition instead :
=IIF(Count(Fields!MyFieldName.Value) = 0, True, False)
This produces the same : When there the SQL query returns no row, I want to hide it.
It's very strange that SSRS doesn't tell my expression is wrong somehow, and last but not least, it's very weird that the expression works in all report levels except from the Main report. Either an expression is wrong or not.
Looks like a bug in SSRS (SQL Server 2017...maybe it's fixed in SQL Server 2019)

Passing Parameters In SSRS

I have 5 reports, which I need to render on seperate pages of an Excel Workbook, so I have created a Master report and intend to call them as subreports. This works perfectly, but the problem is that I need to control the name of each worksheet, and I believe that the trick here is to use a rectangle, and set the PageName property to the desired name of the worksheet.
The issue is, that as soon as I place the subreports inside a rectangle and add a Page Break or a PageName, when I run the master report, I get an error saying One or more parameters were not specified for subreport _____
The same thing happens if I put the sub report inside a list.
How do I either pass the parameters in via a rectangle, or name the worksheets without the use of a rectangle?
I am using SSRS 2008R2
I have got to the bottom of this, and it appears to be the most bizarre SSRS bug. Once you move the subreport inside a list or rectangle and add a Page Break, SSRS flips the date format of the date parameters, and hence you end up passing in values that SSRS does not recognise as dates.
Even more obscure, If you pass flip the date values so that the report succeeds, the next time you run it, SSRS flips them back the other way, and then then they stay flipped that way until you exit the report.
Go back into the report and repeat the steps above once more. I will raise this on Microsoft Connect.

Dynamic subreport in SSRS 2008

I would like to set up a dashboard report in SSRS that contains a bunch of sub reports, but have the reports that are displayed be configurable at run time.
I.E. there could be 4 parameters which represent the names of 4 reports. The report contains 4 reports, and the name of each sub report should be taken from one of the parameters.
It looks like I can't do this, as the 'Use this report as a subreport' property is a dropdown and doesn't provide a way of configuring it as an expression.
Am I right?
Thanks,
Rich
I figure your scenario is just to display one at a time. I needed to do almost the same thing. I have a main report in which I wanted a dynamic number of different subs to be displayed. I solved it like this:
A main report (Main) with a tablix containing a subreport (SubMain), the dataset for Main passes id, subid and subtype. SubMain has no dataset.
And directly in the SubMain I added all my subs (SubDetail) which have their own dataset.
And then I set visibilty for SubDetails depending on type.
/Erik
Normally you'd have to define each subreport in the main report and then set visibility. Or use drill through to emulate navigation.