Excel Function within SSRS 2012 - reporting-services

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.

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.

Is there any easy way to find all usages of a dataset filed in SSRS desinger?

I have a dataset with 15 fields used in different expressions of different textboxes. Is there any easy way to see where each of these fields are used? I mean to get a list of all usages?
I'm using Business Intelligence Development Studio 2008.
This might help ..
In Business Intelligence Development Studio 2008 with the project open.
Click menu .. Edit >> Find and Replace >> Find in Files >
A dialog window will appear for you to search the string. Type in the string you want to search. You should have "Look In:" default to "Entire Solution". Click Find All button
You should be able to see a Find Results window anchored somewhere (on mine it's at the bottom). You will see all the places in your report with the string. Double click on the line will take you to the code where the string is.
Note: Be careful not to enter any values into the code by mistake and save the report form code window as this may break your report.
Sorry not enough points to post pictures.

SSRS Adding text box that accepts input for printing

Using Business Intelligence Development Studio, I am creating a report for SSRS that requires the user to add a few notes before being printed. The notes do not need to be sent back to the SQL Server that the report is being generated from, they just need to be included when the report is printed or exported. I have some other solutions including:
Exporting to Word for edit, then the user can manually publish to pdf & send
Including parameters for the note fields which involves pulling the report, then adding in the notes and lastly re-pulling the report again to include the data
But I really don't want to add the extra steps to the user's process unless necessary. Has anyone tried this before? I've been tinkering and searching and have had no luck.
Thanks in advance.
Input to an SSRS report comes from data sources and the parameters. Some server settings are applied, but all the per-report stuff is from either of those two places.
Based on the OP comment, I would add a text parameter that allows blank values. You can set a default value of ="" so that the report will run on first access. Then any text the users adds can be inserted into the report simply by referring to the parameter's value.(=Parameters!MyParam1.Value)
user is pulling the report first to analyze the data. So they would pull it once, then add the notes, and then pull the report again with the parameters added.

SSRS '08 Object reference not set to an instance of an object

Full error from Preview window in Visual Studio '08 (BIDS): "An error occurred during local report processing. Object reference not set to an instance of an object."
There are no further errors/warnings detailed in the Error List or Output windows.
Background: On this report I am using a table to display a sub-report [x] number of times, dependant on the number of related objects that exist in the SQL database. That is to say that the sub-report is set within one of the cells (the only cell) of the table, in a row that repeats for each item returned in a dataset.
Removing the sub-report allows the master report to compile and run, so I feel the issue is related to the arrangement of the sub-report. If the sub-report only displays once, then the master report compiles and runs fine, it is only when a second instance is required that the issue arises.
When testing the sub-report separately, it compiles and runs when given the parameters for each instance it is being asked to render from the master report. So I can rule out the idea that the data for the second instance is causing it to fail (in some div-by-0 type way).
Given the lack of detail from the error and that the sub-report works on it's own, I do not understand why this is happening.
Does anyone have any ideas for debugging or suggested solutions?
Thanks
Brian
tldr: Master report fails when a sub-report repeats more than once.
I figured out a solution. The sub-report is being passed 4 parameters, one of these had a value referring to the value a table-cell on the master report. Changing this parameter to be the value of the expression that was setting that table-cell fixed the issue. I have no idea why this is a solution, but it is.
In more detail: [table_cell_a] had an expression computing it's value.
[parameter_a] for the sub report was set as "=ReportItems("[table_cell_a]").Value", when I changed the expression for [parameter_a] to mirror the expression for [table_cell_a], everything worked again.
This is messed up, and I can't even begin to understand why it behaves like this. If [table_cell_a] was not being computed before the calls were made to the sub-reports, I could understand. But if that was the case, how come the report worked when there was only one sub-report?
If anyone can provide an explanation, I would be most grateful.
Brian
Brian,
I'm having a similar issue with charts imbedded in a Tablix. I found this article that seems to address the issue, although I have not gotten the server upgraded yet to actually test it:
http://support.microsoft.com/kb/2639301
Hope that helps.
G
I was getting the similar error after changing the names of reports in my project even though I changed all the updated report names in the Action property.
An error occurred during local report processing. Object reference not set to an instance of an object.
I found a solution by running the dataset of linked report providing the parameter values manually.
I am not sure what difference it made by running the dataset of linked report manually but it solved my problem and I am no longer getting this error.
Thanks
Yogi
Just sharing. In my case, it was not a sub-report. I had the same message when I was accessing a drill-through-report. Apparently, at the "Action: Go to report" > "Specify a report:", I have wrongly pasted the full name of the report with the extension. Removing the ".rdl" extension solved my problem.
Addendum: If the drill-through report name is part of an expression then the .rdl extension is necessary for it to work when hosted in SharePoint. That prevents it working in preview mode, as you've found. Solution is to code to avoid having to use an expression for the report name.
Copy the Dataset and Queries.
Create new report or copy paste Tablix to new report. You will not get the error again.
I had to remove the SubReport and add it again. Then it worked.
I had the same error when I changed the name of the report I drilled to. I did change the name in the action expression to the new name via the properties > Action > Go to Report > (...) > Expression, but that apparently didn't take. When I opened the text box > Properties dialog window instead of using the Properties pane, and changed the drilled to report name within that window, it solved my issue.

How do I prevent header chaos in, SQL Server 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.