First page of SSRS report not rendering on initial load - reporting-services

I've created an SSRS report in Report Builder 3 which contains a single-rowed Tablix that holds a sub report which produces a single report per page. The problem is that when I run the report it doesn't render the first page.
Within Report Builder I can never get this first page to display within the executed report and within the web forms ReportViewer control (v10.0.0.0) I can get this first page to appear when I page away and then back to it. Exporting the report also displays all of the correct data.
This issue has only started occurring since I made some slight changes to the layout of the sub report. I've checked the visibility on the tablix, group, row, sub report and all the other settings that I thought might be responsible, but they haven't changed since it was previously working.
I've also tried recreating both the tablix and the entire outer report based on an answer to a similar question and this didn't make a difference.
Any help with this issue would be much appreciated.

I was passing the data for my sub reports through as parameters to prevent the need to call 5000+ single line select statements, and it looks like they need a data set to execute to render correctly on the initial load. Previously, I had mistakenly left a data set within the report, which I must have removed when making the layout changes.
Creating a dummy data set with SELECT ' ' AS Dummy and then using that to populate a text box seemingly fixed the issue. It's not a clean solution but it works.

Related

Don't produce report if there is no data - PDF

I have a report for which there is sometimes no data to output. This report is run along with several other reports and all are then output to PDF. However, this report still produces the header and footer with a blank page even tho there is no data.
I can move the header and footer into the report and have tried to hide those elements with =if(rownumber("PersonalProfile")=0, True, False) in the Hidden property of those elements. It hides everything so now the page is blank, but it will will output a blank PDF. Is there a way to completely suppress the report?
I'm using 2008 and I don't see a Report Visibility property. All the data for the report is inside a single Tablix which is inside a rectangle.
There are 3 datasets: PersonalProfile which contains the meat of the data; BoardNames which just produces the name of the board for the report; BoardMeetings which allows the user to pick a date parameter.
If you are distributing your report using subscriptions and you have Enterprise Edition, then you can look at using Data Driven Subscriptions which will give you control over how and when reports are distributed based on whatever logic you need. Otherwise, there is no way to do what you are asking - as trubs says, Reporting Services must first render the report before it has any knowledge of whether there is any data to display.
You haven't explained how you are "running the reports" (e.g. manually in Report Manager, report subscription, third party app using URL access) - if you do perhaps someone can suggest a workaround.
There is no way to do what you want. ssrs has to produce the report in order to determine there is nothing to display.

SSRS 2008 Rendering to Word from URL gives different output to Exporting from Report already rendered on screen

I have a report created in VS2008 on SQL Server 2008 (SP3).
The report comprises of several sub reports nested 3 or 4 levels down in some instances. Document Maps are used extensively so that Word Tables of Contents can be generated further down the line.
Now here's the problem.
If I render to screen either in the development environment or rendered the deployed report from the reporting services server, then everything is OK. If I export the report in any format (tested with Word, PDF & Excel) then the output is as expected.
However, if I create a URL including all the parameters something like
http://MYSERVERNAME/ReportServer/Pages/ReportViewer.aspx?%2fMYPATH%2fMYREPORTNAME&PARAM1=999&PARAM2=999&PARAM3=999&rs:Command=Render&rs:Format=HTML4.0
then paste this into an IE window, the output is incorrect.
Well let me clarify that.
If I render as above using the HTML4.0 rendering extension then the report renders on screen as expected, all the content is shown.
If I render to Word by changing the rs:Format parameter to Word then the report renders but the first page is missing (see note about this content below)
If I render to PDF, the same part of the report is missing.
If I render to Excel, the document map generated on the first workbook sheet shows an entry for the missing section of report but clicking the click gives and 'invalid reference' error and indeed that part of the report is again not rendered.
Note that the 'master' report for want of a better term is made up of 3 subreports, each of these contain other sub reports.
Its the content of the first subreport, that also happens to only every show on the first page (as it is just less than a page long) that is missing.
In Word there is something rendered but it looks like an empty table with a width that is the full width of the page but a heigh of just a few millimetres.
I'm really at a loss as to why the section does not render when it works perfectly if rendered to screen and then exported. I had assumed they would use the same rendering process but I'm not sure.
I'll continue to experiment, maybe add some blank content before the problem section or something and see where I get but I'm puzzled as to why this happens, other reports do not suffer the problem (however I have only tested 3 or 4 or the hundreds that I have written).
I've not used the URL method much in the past but I got to this point as I was writing a c# application to run the same report with varying parameters to produce over 1200 word documents, each of which takes about 2 mins to run. the output was incorrect there so I worked my way back to creating a manual URL and the problem was still apparent, the rest is history!
I finally found the answer.
The subreport that was causing the problems takes parameters that are subsequently passed on to other child subreports. While I was testing these, I had datasets that provided the available values for the parameters (list of countries and their associated ID's for example).
My normal method of working is to remove all datasets that are only used to populate parameters in all subreports as this improves performance (the report does not have to query the database to get a list of countries for example).
However, on this occasion I had removed all the datasets (which in itself was fine) but I had left the datasource in place (visible in the report data pane).
Once I removed this redundant entry, the report rendered as expected.
Now I'm still not sure why it rendered OK to HTML4.0 but it would appear that when rendering to other formats there is some process going on that looks at the datasource perhaps and as there is no data (as there are no datasets) then the report is not rendered. That's a bit of a guess but it's the only thing that makes sense to me at the moment.

How Can I avoid Blank pages from SSRS PDF files?

Am creating One report project. Where am having one normal report named (Report1.rdl) and one sub report named (Report2.rdl).
Am calling the main report in side the sub report five times by passing values through parameters. So I have five parameters as well. when parameter value is 0 then respective report will not show in the sub report. But thing is that when am doing this am getting blank pages at the end and between the pages as well.
So can You please help me With this. I have already checked with the sizes and clear designing of the main report.
You are 'calling' the reports in the incorrect order.
Main reports 'call' sub reports, not the the way you have it at the moment. Therefore you need to embed the sub-report inside the Main report. As detailed here on MSDN:
"A subreport is a report item that displays another report inside the
body of a main report. Conceptually, a subreport is similar to a frame
in a Web page. It is used to embed a report within a report."

MS Access: Reports referencing other reports

I have several MS Access 2010 Reports that contain controls that reference other controls on other Reports. So, for example, if report1 has a text box called report1_textBox, and this text box gets its value from a text box on report0 called report0_textBox, then I set the Control Source property of report1_textBox to:
= [Reports]![report0]![report0_textBox]
I created a Form that the user can use to select Reports to open, and when the user selects a Report that depends on other Reports, my code opens those Reports before opening the selected Report. This works fine in some instances, but in other instances I get some strange behavior.
Going back to the example above, I encounter situations where even if I open report0, then open report1, the text box report1_textBox displays #Error as if report0 is closed or does not exist. But if I then just click on report0 and change its view then change it back, then go back to report1 and scroll a little, the text box report1_textBox "magically" changes from #Error to the proper value. I tried hitting the "Refresh All" button after opening the reports, and it does not update the text box.
Does anyone know of a way to fix this or at least work around it?
Thank you!
(Adding: Ideally, I do not want to open multiple reports like I'm doing now. If the user wants to view a report, I would like to only open that report, but from what I understand, if the selected report needs data from another report, that other report needs to be open. I can ultimately solve this by writing VBA code to execute queries, but I would like to avoid this, especially since I already have the data I need - it's just on another report. Does anyone know if it is possible to realize this ideal situation? Thanks!)
I would suggest going with VBA code for this.
Your question, actually, contains an answer (partial) - if you need data from another report that report must be opened first. However, the following code might help you somewhat.
You can open report(s) as hidden:
...
DoCmd.OpenReport "report0", acViewReport, , , acHidden
...
But again, I would recommend to write VBA code to pull the data using either existing queries from other reports or create new ones [queries].

First page of MS Access Report does not seem to call On Page Event

I have coded a MS Access 2000 report that displays a calendar with one month per page and projects added to particular days. The only data in the underlying record source is a list of months. The structure is created via the On Page event, which also reads in other data.
When this report is opened, I've noticed that the On Page event does not seem to be triggered for the first page. (I attribute this to the fact that On Page in reports is activated when a page is cached rather than when a page is displayed, such as On Current for Access forms.)
When the report is displayed my work around is to use the On Activate event to force the On Page subroutine to run even though that event has not been called. However when the report is exported it does not trigger the On Activate event and the first page of the export is in one of two formats:
1) if the report was open in Access (ie On Activate had been triggered previously) the first page is identical to either the page after the one being displayed or the last page, except with the correct month (which comes from the underlying record source)
2) if the report was not open in Access the first page contains just the structure within the report design view (ie lots of empty boxes)
My best workaround is to force a (otherwise pointless) cover page to ensure the first page contains nothing that needs code to run, but this is far from ideal. Can I force the code to run for the first page of an export? Or maybe I'm misunderstanding how On Page works and I need to restructure my code? (I've also noticed that On Page seems to run twice for the last page).
I would recommend restructuring your code so that you build your data in one query, multiple queries, or in VBA, and then open the report with the new datasource. I might still have Access 2000 at home to check, but at work I can test both 2003 and 2007, and in both versions, the OnPage event fired before each page was displayed. If you are experiencing different behavior, I suspect it's because Access isn't sure how to handle what you are asking it to do.
Typically a report like the one you are describing would be designed the other way around: the datasource for the report would contain all the project information. Is there something about the data you're trying to display that prevents you from building a query that would contain all of it?
Have you considered the Format event for the various sections, especially the Detail section? Format or Print are a more usual events for manipulating reports.