Download presentation
Presentation is loading. Please wait.
1
Tips and Tricks for Reporting Services
November 12, 2016 Pam Shaw Open SQL Management Studio and Visual Studio Open Windows Explorer folder to template location Restore RSSample1 for Inventory examples. Run: Build Work Area script to reset work area in SQL In Windows Explorer go to folder: My Documents\Visual Studio 2005\Projects Copy project to subfolder: Tips and Tricks for Reporting Services C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\ProjectItems\ReportProject In SQL: Execute queries: Build work area In Visual Studio open project: Tips and Tricks for Reporting Services – preview report – minimize Make sure that the solution explorer is available on the right side as well as properties
2
About the Speaker BI Specialist at Tribridge
Chapter Leader of Hillsborough SQL User Group Hillsborough TampaSQL.com SQL Saturday Tampa organizer
3
Agenda Dynamic Formatting Dynamic Columns Dynamic Data Sources
Templates Brief overview of On Demand Subscriptions
4
DVD Library
5
Dynamic Formatting Hyperlinks Data driven text color
Negative numbers Color coded indicators Alternating backgrounds (green bar effect) Formatting numeric values “Spanning rows” DEMO Hyperlinks: Tab to SQL and show database and table Tab to Visual Studio Show previewed report Discuss how the hyperlink serves no purpose as a column – but making the title a hyperlink would make the link useful. Click on Layout tab then Title field and activate Properties. Under Misc. - click on Action and the expression expander. In dialog box, click Jump to URL. In drop down select Link field – click OK. Preview that the link works and return to layout. Delete the Link column and resize remaining columns. Preview the report – return to layout. DEMO Data driven text color: In our report, we are going to color code the lines by who in my family is most likely watch this movie. Any Genre starting with ‘Chick’ will be Maroon for me. Any Location equal Ryan will be green for my son. Highlight Title, Genre and Location fields in grid. In properties, click color under appearance. From the drop down, click Expression (top option). =iif(left(Fields!Genre.Value,5)="Chick", "Red", iif(Fields!Location.Value="Ryan","Lime","Black")) Note: be sure to show the ability to click for the field names with a single field highlighted. DEMO Alternating backgrounds: Bobby, my husband complained that he doesn’t like the ‘all white’ background for the details – he wants them ‘green barred’. We are going to use the color Azure. Open Common Function – then Miscellaneous and select RowNumber. Note that RowNumber requires a SCOPE. In the case where there are no groupings, the only scope available is Nothing. =iif(RowNumber(Nothing) Mod 2, "Azure","White") DEMO Suppressing zeros: (the following is not available as part of the download) Let’s look at a more complicated report. Open Inventory. Click preview. Here are the issues our analyst saw when she looked at this report: She did not want to see zeros print – they want the cells empty instead of a zero. On the Layout tab, highlight the number cells (2 rows), click Appearance, Format and populate the field with #,#. I recently found that this was not enough in some cases. In those cases, I actually had to set visibility to hidden when the value = 0. Another option to keep in mind. Click Preview. DEMO “Spanning rows”: The first column’s header is showing as 2 rows when it should ‘span’ the 2 rows shown for the rest of the columns. RS does not allow for a means of spanning rows – so we have to ‘fake’ it. On the Layout tab, click the empty text box of the first row of the first column. We need to remove the bar that separates the first row from the second row – but retain the sides. Click properties, Appearance, BorderStyle. Note default is Solid. We need to make the Bottom = None. Click the text box of the second row of the first column, properties, Appearance, BorderStyle. We need to make the Top = None. Click Preview and note that what we thought should happen, does not. This is because the default is Solid. We need to make the default None for both boxes and fill in only those line we really want.
6
Formatting numeric values
Format Style Format Code Example Suppress Zeros #,# 9,999 Currency C C2 -> $9,999.99 C0 -> $9,999 Decimal D D -> 9999 D6 -> Fixed-point F F2 -> F0 -> 9999 Number N N2 -> 9,999.99 N0 -> 9,999 Percentage P P > % # is multiplied by 100 ad displayed with %
7
Dynamic Columns Hidden columns UserSort on Demand
Click in the column headers Data drive the column headers DEMO Hidden Columns: You can hide columns in at least 2 ways Completely – nothing of the column shows at all Partially – sections of the column are visible Completely hidden: In SQL – run the query for the Inventory. Note how the data brings back up to 10 types – but only up to 6 print because they have data. Return to the Inventory layout. Click on the table column definition cell (grey) and drill into appearance, Visibility and show the expression in the hidden property to show additional hidden columns. Partially hidden: (demo no longer available) Finally, the Density column should not print for the first grid grouping. Each text box in the Density column needs the following under: Appearance, Visibility, Hidden using Expression from the drop down: =iif(Fields!GroupNumber.Value=1,True,False) Preview the report. DEMO UserSort on Demand: Return to the DVD Listing. To allow the user to define sorting based on a specific column, click on the header cell of each column to be allowed sorting, Under Properties Data, UserSort and select the appropriate field in the SortExpression drop down. Do not populate SortExpressionScope or SortTarget unless you have groupings active. DEMO Data drive the column headers: Click on Inventory Report Open SQL and run the query to show the data being returned. Back in report – show the layout and then preview the report. Click on the column header cell, drill into data, then Value – show the expression. Note that for the column header this could be a separate dataset. If it is in the same dataset, you need to pull a single value – FIRST accomplishes this.
8
Dynamic Data Sources Parameter driven You can define:
The Server Name The Database Name The User … and more You do need to know what the Connection string should look like DEMO Dynamic Data Sources: Return to the Inventory report. Click on the data tab. Select a dataset and click the … In the Dataset Dialog box, click the … next to Data source. Click the fx next to the Connection string box to show the builder for the string. Note that you need to know what the connection string should look like before going here. Review how existing parameters can be inserted. Cancel out. Back in the Data source dialog – review the credentials page. Cancel out to the data tab Verify that all SPs are still set as SPs. Point this out as a pain. Click to the Layout tab. (Second data set not available to demonstrate that changing the DB would drive to another connection) Right click in the lower portion below the actual layout area and select report parameters. Nav around. Click preview report. Change the DBName to RSSampe2. Click View Report.
9
Templates Provide consistency for appearance and functionality
Only helpful when creating a new report Changes made to the a template will not reflect on existing reports Location: C:\Program Files\Microsoft Visual Studio x\ Common7\IDE\PrivateAssemblies\ ProjectItems\ReportProject DEMO: From Solution Explorer, Right click on Reports folder, Click Add and New Item. In the dialog box review the Templates from the template folder are available for selection.
10
On Demand Subscriptions
Standard subscription Creating, Modifying, and Deleting Subscriptions msdn2.microsoft.com/en-us/library/ms aspx Look at the table: ReportServer.Subscriptions Data Driven Subscriptions for Reporting Services By Jason Selburg, 2007/02/14
11
Resources Expression Examples in Reporting Services
SSW Rules to Better SQL Reporting Services 2005 Numeric formatting
12
Resources continued RS Scriptor for scripting reports.
This creates the RSS which is the snippet scripts in VB.NET which are in turn run by the CMD file.
13
Contact Info You can reach me at: @pamshaw (twitter) User Group Web Site Hillsborough.SQLPass.org
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.