Resolving SSRS and PowerShell New-WebServiceProxy Namespace Issue

When you’re working with PowerShell and SSRS, you may occasionally come across a script that works once, then just mysteriously decides not to work anymore on a second or third invocation. Or it may just not work period, even though you think the syntax is short and straightforward, and you know you’re not misspelling any syntax.

Please note I am running this on the PowerShell ISE, and PowerGUI – and tried on both PowerShell V2 and V3.
Continue reading

PowerShell and SSRS: Passing Values to Query-Based Parameters Programmatically

I wanted (needed!) to write a script to automatically generate a number of reports based on sets of parameters. Most of the scripting I’ve done before are for straight up parameters that I can pass using SMO or through the URL string.

This time, I had a cascading query-based parameter, ie one parameter that is filled out based on another parameter. I was doing my usual drill with PowerShell when I got the following infamous error:

“This report requires a default or user-defined value for the report parameter. To run or subscribe to this report, you must provide a parameter value.”

Which is weird because I did provide all the required parameters. A quick search leads me to a few blog posts, most of which mentioned that it’s because of my query based parameter. Most also suggest the resolution is to convert my parameter which has query-based parameter to be non-query based.

The only problem is I can’t. And I don’t want to. That’s not a resolution. This report is meant to be used both by users for ad hoc purposes, and for massive downloading for month-end reports. Removing the query-based values for a parameter *IS NOT* a resolution. Not for me anyway.

Continue reading

Download SSRS Parameterized Reports in PDF with PowerShell

Here’s a short PowerShell script that :
1. Connects to your report server
2. Loops through a set of parameters stored in an array
3. Saves the PDF version of the report to a local folder, with appropriate names

Here’s a snippet of code to set your SSRS parameters programmatically using PowerShell

  $params = $null;

  #set parameters
  #here's a sample usage http://msdn.microsoft.com/en-us/library/microsoft.reporting.winforms.reportparameterinfo(v=vs.80).aspx
  $params = new-object 'Microsoft.Reporting.WinForms.ReportParameter[]' 3
  $params[0] = new-Object Microsoft.Reporting.WinForms.ReportParameter("FISCALYEAR", $fiscalyear, $false);
  $params[1] = new-Object Microsoft.Reporting.WinForms.ReportParameter("MONTHENDDATE", $monthenddate, $false);
  $params[2] = new-Object Microsoft.Reporting.WinForms.ReportParameter("SALESGROUP", $salesgroup, $false);

  $rv.ServerReport.SetParameters($params);

Of course this is just a sample, you can definitely extend this by using SMO to automatically pull parameter values, or use values stored in a file (among a million other things you can do with ubercool PowerShell)

Continue reading

SQLSaturday#65 SSRS 2008/2008 R2 from the Ground Up

Thank you to all the troopers who attended my really-early-morning-cold-and-snowy session at SQLSaturday#65 in Vancouver, BC. It was such a great event; thanks to all volunteers, sponsors, speakers and organizers (kudos to Scott Stauffer (blog | twitter) .. Thanks to Todd McDermid (blog | twitter) too for helping me give out swags during my session, and thanks for the great powerpoint slide decks which I’ve used in 2 SQLSaturdays now! 🙂

sqlsat65-schedule

As promised, here are the SQLSaturday#65 presentation materials for SQL Server 2008/2008 R2 Reporting Services from the Ground Up

Brent Ozar (blog | twitter) has a few pictures of the event 🙂

Sample Reports (pdfs)

Report with different visualization components (data bar, sparkline, indicator, gauge, chart)
sqlsat65 - sample report - employee sales with visualization

Report with drilldown, barcode, gauge
sqlsat65 - sample report - employee sales with drilldown barcode and gauge

Report using map (from ESRI shapefile for Canada) and Bing Maps layer
sqlsat65 - sample report - canada sales on map
Continue reading

Your report is only as good as your requirements

Your report is only as good as your requirements.

When I first worked with reports and reporting services, I was excited and giddy. Beside my plain old text and T-SQL, I now get to work with some shapes and colors! And look ma, no hands, err, it’s drag and drop!

But the fascination with colors, drilldowns, drillthroughs, what-have-yous fade away as quickly as that drag and drop. You realize fast that – although managers typically like the pie charts, the drill downs, the colored legends – if any number, or any minor thing for that matter, is not “right”, the whole report is not right, and all your work really goes down the drain.

Sometimes, it’s not because the report is “completely wrong”.
Continue reading

Retrieve SSRS Report Definition, Role Assignments, Executions Using T-SQL

Just a few queries against the ReportServer database that might come in handy…
Of course, these are just some sample queries. Tune and modify according to your needs …
Continue reading

SSRS Tidbits – Common Tips, Tricks, Debugging and Other References (Part 1)

.ssrstip
{
background-color:#FFFEEB;
display:block;
border:1px solid #E6DB55;
}

Just wanted to share some common “tips” or “tricks” I find myself using over and over again when creating reports.

I think I’ve had this draft for a while, and just never was able to publish it because things got so busy. Anyway, I will just publish in parts. Better late (and something) than never (and nothing!)

Common Report Tasks

Common page headers and footers

Report (reportname) generated by DOMAIN/User on 02/03/2010 4:51:03 PM
="Report (" & Globals!ReportName & ") generated by " & User!UserID & " on " & Globals.ExecutionTime"

Page X of Y
="Page " & Globals!PageNumber & " of " & Globals!TotalPages

If you have start and end date parameters, and want to display them in your header or footer, with date formatted as MMM dd, YYYY
="Report Details from " & Format(Parameters!StartDate.Value, "MMM dd, yyyy") & " to " & Format(Parameters!EndDate.Value, "MMM dd, yyyy")

Continue reading

SQLSaturday #43 (Redmond) – SQL Server Reporting and SQLServer/PowerShell

I would like to say a huge and warm thank you to all who attended my sessions for SQLSaturday#43 in Redmond. It was such a great event, and I hope you enjoyed the sessions – and enjoyed the whole day with all the wonderful speakers.

sqlsat43 redmond sessions

As promised here are the files for my sessions:
Continue reading

SQL Server 2008 Reporting Services Book Shelf

These two books are great, and they almost never leave my desk. I’ve been reading them nonstop.

Prologika Press. Applied Microsoft SQL Server 2008 Reporting Services by Teo Lachev


Microsoft SQL Server Reporting Services Recipes: for Designing Expert Reports by Paul Turley and Robert M. Bruckner


Exploring SSRS 2008 R2 Report Manager

SQL Server Reporting Services 2008 R2 (based on November CTP) has received a makeover! It looks more SharePoint-ish, especially with its new blue theme, contextual dropdowns, and ajaxified operations. I quite like the changes, this definitely feels more “user friendly” to me.

Download document/screenshots: Exploring SQL Server 2008 Reporting Services R2 Report Manager

Report Manager – Home Page

The new theme is easy on the eyes. When you hover over the items, whether it’s a folder or a file, there will be a contextual dropdown. Feels very much like SharePoint (2010).
SSRS 2008 R2 Report Manager Home Page

Report Manager – Site Settings

On the Site Settings page, you have General Properties, Security and Schedule.
SSRS 2008 R2 Report Manager - Site Settings

Report Manager – Data Source Properties

Data Source Properties page looks familiar, with the exception of Dependent Items. Dependent Items page will list all items (reports, data sets) that use this particular Data Source.
SSRS 2008 R2 Report Manager - Data Source Properties

Report Manager – Search

Yes, you can now search in SSRS Report Manager! Type in your keyword, and away you go! It will find your report, your data set, your folder, or even your report part.
SSRS 2008 R2 Report Manager - Search

Report Manager – Report Contextual Dropdown

If you have worked with SSRS in Integrated Mode in SharePoint, the contextual dropdown in the revamped Report Manager will look familiar. When you hover over a report item and click on the down arrow, you will be able to move, delete, edit in Report Builder 3.0, and explore other properties, to name a few.
SSRS 2008 R2 Report Manager - Report Contextual Dropdown

Report Manager – Report Properties

If you clicked on “Manage” in the contextual dropdown of a report item, you will be taken to this page. Note that on the left column, you have links for : properties, data sources, shared data sets, subscriptions, processing options, cache refresh options, report history, snapshot, and security.
SSRS 2008 R2 Report Manager - Report Properties

Report Manager – Shared Data Set Properties

Finally there is a way to share data sets among reports!
SSRS 2008 R2 Report Manager - Shared Data Set Properties

Report Manager – Shared Data Set Caching Properties

And yes, you can also cache these shared data sets.
SSRS 2008 R2 Report Manager - Shared Data Set Caching Properties

To infinity and beyond

(You can tell I’m waiting for Toy Story 3) .. I’m excited to work with SSRS 2008 R2. Besides changes in the Report Manager, there’s quite a few more exciting additions. In my next few blogs I will post some mini tutorials on creating spark lines, data bars, indicators and map integration.

Download document/screenshots: Exploring SQL Server 2008 Reporting Services R2 Report Manager