How do I prevent header chaos in, SQL Server Reporting Services - reporting-services

Hopefully someone will be able to help me with this! I'm trying to get a sensible Excel layout for an SSRS report, right now the header, which consists of an image and two textboxes, appears to be causing strange sizing issues, and additional "merge cell" issues with blank columns being inserted into excel.
Basically, I've read that matching images in header to be in line with columns in the report prevents ghost columns/merged columns, and I've also read that you can use the SimplePageHeaders in one of the RS setting files to assist keeping Excel renders clean.
Regarding
1) When I match the column widths in the designer (2008 R2) it snaps with a nice blue line, but when showing preview mode and in fact deploying + using RS.EXE to create an excel report, the column sizes change. This is despite turning all Autogrow/Autoshrink options to false.
2) As I'm not using IIS for these reports, and am generating from the commandline using RS.EXE with RSS scripts, I can't work out where I'd set the SimplePageHeaders xml option on. I've not been able to locate the RS config file in any of the usual locations, despite exhaustive searching.
Before I give up and buy a third party solution, am I missing something?

Using the rs.exe utility, one of the parameters to the Render method is for DeviceInfo settings. You should be able to construct a DeviceInfo string to set SimplePageHeaders to true when you call that method. This is the way that DeviceInfos are specified if you're not using the server-based rsreportserver.config file.
Here's a rough example:
http://msdn.microsoft.com/en-us/library/reportexecution2005.reportexecutionservice.render.aspx

First google on 'SimplePageHeaders' yields
"How to edit rsreportserver.config to configure SimplePageHeaders"
http://social.msdn.microsoft.com/forums/en-US/sqlreportingservices/thread/4f5b0154-b5b4-4789-8ac9-06fb53370d85/

Regarding 1) When I match the column widths in the designer (2008 R2) it
snaps with a nice blue line
Check the Size and Location properties specifically: items snapped to the grid may still have variations, causing those pesky extra columns.
For example, I have a report where the (snapped) header textbox has a width of 5cm but the 3 (snapped) columns below it in the Body have widths of 1.5, 1.5 and 2.02645cm respectively.

Related

Is there a way to publish main and sub SSRS reports using report builder?

Dears,
I am quite new with Report Builder, and also with SSRS so sorry in advance if I raise irrelevant questions. My goal, essentially, is to deploy a sort of SQL Monitoring dashboard (I just uploaded a demo picture of it, here the link 1 ), that is composed by a main report with some charts and toggled sub reports. All these sub reports are filtered by the SQL instance name, and other parameters like number of monitoring days, months etc...
Plus I make use only of shared datasets.
Now, if I deploy the whole solution with Visual Studio against my report server, it works perfectly and all the report parts are uploaded without any issue against the report site.
If I try to deploy the report using the report website manager (by trying to upload the whole solution file by file), it does not upload anything, even if I create first the data source and then trying to add the existing datasets.
If I try to deploy the solution with Report Builder (after having giving to it the target report server URL and an existing folder that starts with slash), the only option I have is to open the solution as file, and save it against the target report server configured. But then the annoying error appears even if I the path has less than 260 char and even if the path starts with the slash:
"Error: The path of the dataset "" is not valid. The full path must be
less than 260 characters long; other restrictions apply. If the report
server is in native mode, the path must start with slash.
(rsInvalidItemPath)"
What am I doing wrong? I thought that a tool like that, used also for publishing, would make the life easier, but apparently I may not know exactly how to use it.

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.

Excel Function within SSRS 2012

From what I have read this may not be possible but thought it was worth asking, I am trying to Export a SSRS 2012 report but maintain an Excel Function at the same time.
I have a Text Box in my SSRS report which when export always appears in Row/Column D33 I have a figure of 20. I have coded in to a Cell on my report =D33* "a figure that is returned in the report, the Expression I have used is ="=DD3*"&Cint(Fields!LABC_Hours.Value), when exported this comes out as =D33*5 but what is should be doing is the calculation =20*5. Is there a way of doing this?
Thanks in advance.
Short answer is no.
As you've probably seen in your research, there was limited support for this in SSRS 2005 but not in subsequent versions.
See Breaking Changes in SSRS 2008.
In earlier versions of Reporting Services, there was limited support
for translating expressions in RDL to Microsoft Excel formulas. In
this release, when you export a report to Excel, RDL expressions are
not translated to Excel formulas.
Needless to say, this is a popular request, see this Connect item:
SSRS 2008 export formulas to Excel.
While refreshing my memory about all of this, I did see a few notes that suggested if you use expressions which directly reference the ReportItems collection like:
=ReportItems!val1.Value + ReportItems!val2.Value
Then this would work, but I ran a simple test now in SSRS 2008 and it made no difference.
I think the general consensus is that you're just out of luck on this one, sadly.
If someone is still interested with this, I developed solution for that, it can be considered ugly but it let me escape many pain in my experience with SSRS.
For those who wants detailed description of ideas (I think its needed anyway because the solution is not so obvious): https://github.com/GrafGenerator/ssrs-formularize.
In short: this is custom rendering extension, which intended to hide ExcelRE from SSRS (Formularizer uses ExcelRE under the hood), and trigger formulas processing when needed. The idea is to mark some report items with "anchors", and then in other report items write textual formulas in special simple DSL that will link to cells with anchors after excel doc is generated.
Important: anchor and formulas added to report item's Action URL, as it seems the only report item field that can be accessed when rendering extension is working without breaking functionality (we can send almost anything here is cook it right way).
So, words report items "has anchor" or "has formula" means that report item action set to URL and expression =code.EncodeFormula("current item identitier (anchor)", "current item formula")
Sample steps are (with table):
Did once per SSRS instance: compile binaries and install to SSRS per instructions in repository.
Strict: Add custom function to your report: https://github.com/GrafGenerator/ssrs-formularize/blob/master/encode-function.vb
Strict: Add custom property to report - key is "formularize", value can be any
table row has report items (textboxes) txtA, txtB and txtC.
4.1 txtA has anchor comp_value
4.2 txtB has anchor output_value
4.3 txtC has formula IF({cell 'comp_value' row} > 0, {cell 'output_value' row}, "N/A").
Result in excel file is formula IF(A1 > 0, B1, "N/A") for first row, row numbers 2 for second row, 3 for third and so on.
The same is for column and all scopes. More examples are on project github page.
I hope this helps someone, feel free to ask question and post issues to the github repo.

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 to display an external image in SSRS?

I'm trying to display an external image within a SSRS 2005 report, however I can't accomplish that. I've tried a lot of things but they just don't work.
I have a table in my report that displays a dynamic image based on code, I thought the error was in the code however it wasn't because I can see the image in BIDS, however when I try to display it on the report server or within an ASP.NET webpage it doesn't show up.
My Code is as follows:
Function ShowImage(value as Object) As String
Dim strImg as String
If value < 0
strImg= "http://icons.iconarchive.com/icons/fatcow/farm-fresh/24/traffic-lights-green-icon.png"
ElseIf value > 0
strImg= "http://icons.iconarchive.com/icons/fatcow/farm-fresh/24/traffic-lights-red-icon.png"
Else
strImg= "http://icons.iconarchive.com/icons/fatcow/farm-fresh/24/traffic-lights-yellow-icon.png"
End If
Return strImg End Function
The value in my image control is as follows:
=Code.ShowImage(Fields!Diferencia_Entre_Importes.Value)
When I see the preview in BIDS it shows up the way it's supposed to be, but it doesn't happen in the report server.
As you see the images don't need any kind of authentication, besides that, I tried configuring the Execution Account with the same result (I just get a horrible X instead of the image)
I also tried setting the image's value as
http://icons.iconarchive.com/icons/fatcow/farm-fresh/24/traffic-lights-green-icon.png
But had no success, also I tried using an image in the server in this way:
file:ImagePath
And had the same problem, using all of these solutions I can see the image in BIDS, but not in the Report Server.
Thank you very much
I suspect this is caused by an internet access issue on the account on the server running the SSRS report. Whether it is or not, I recommend saving those .png files locally on the server, and modifying the code accordingly - it should improve report performance as well as getting rid of this issue.