Post on 17-Sep-2018
transcript
Report Writing Using SSRS
Monday, May 22, 20179:00 AM – 4:00 PM
Elizabeth Wojcik, Computer System InnovationsTrisha Haas, Computer System Innovations
• Beginner – never built an SSRS report• Intermediate – built simple reports, edited reports. • Advanced – built more complicated reports with multiple
formulas and datasets• Expert – building from SQL code mostly
What do you know?
• SSRS stands for SQL Server Reporting Services– This is the reporting tool that can be used to create and modify
SSRS reports
• SSRS is a server based report generation software• Similar to Crystal Reports, but is much more robust
– Crystal creates a rpt file– SSRS creates a rdl file
What is SSRS?
• SSRS is replacing Crystal as the report engine for iMIS– All new reports written by ASI are SSRS reports
• You already own SSRS with SQL server, but recent versions of Crystal cost your organization $$$
• Enhanced tools compared to Crystal• Could offer more flexibility over IQA as well as speed
Why use SSRS?
• Create a Request Process – What is the end goal?– What are you looking to do with this data?– Who is your audience?– Where do you want to access this report?– Will this report be used long term or one time only?
Requirements Gathering
• Table and Field naming best practices– Table names
• Start with a prefix– Demo_Communication– CSI_Membership_Stats– DO NOT use “Name_”
• Use upper and lower case• No spaces! Only underscore
– Field names• Start with a prefix that is an abbreviation of the table name
– CM_OPT_IN• Use ALL CAPS• No spaces! Only underscore
Let’s take a step back
Visual Studio vs. Report Builder
• Visual Studio • Report Builder
For more information: https://technet.microsoft.com/en-us/library/dd207010(v=sql.105).aspx
• Report Data Pane• Solution Explorer• Properties• Server Explorer• Toolbox
Getting Familiar with SSRS, cont.
• RiSE• Report Manager• Other tools with Microsoft Report Viewer control (ICE)
Ways to Access/Share Data
• Create and edit an SSRS report with the Report Wizard• Modify an existing iMIS SSRS report
– Where to find– Best practices for cloning
• Create an SSRS report without the Report Wizard• Crystal to SSRS – use caution!
Different Ways to Create/Modify SSRS Reports
• iMIS Table Structure
• Basic expressions– Select * from Name
• Report Style– Tabular vs. Matrix
vs. List
• Creating a solution, project and shared data source (Handout)
Creating Basic Reports
• Using the Report Wizard
• Helpful tool for beginner to advanced users
• Follow along with the Handout for step by step instructions
Creating Basic Reports, cont.
Basic Filter Examples
• Member_type=‘MEM’• Status=‘A’• State IN(‘IL’,’MO’,’TN’)
– “= X” for equal to– “<>X” for not equal to– “>X” for greater than– “<X” for less than– “is in (X,Y,Z)” for multi values– “not in (X,Y,Z)” to exclude
multi values
• Create a report using the Report Wizard – use the Handout as a quick reference guide
• Use the following tables– Name– 1 custom user defined table from your database
• Use the following filters– Member type = Select one of your member types– Status = Active– One other filter of your choice
• Display– Full name– Member type– State– One or more fields from your custom user defined table
Lab 1
• Follow along with Handout for step by step instructions– Importing .rdl into iMIS– Creating Content Record with a Report Display content item– Deploying the new content into the site
Loading Reports to RiSE
• Follow along with the Handout for step by step instructions
• Overview:– Download RDL file from
sample IQA– Modify report to add
chart– Save– Upload report back into
iMIS
Using an IQA as a Data Source
• When wouldn’t you use the wizard?– List/Freeform Report– Using a report to execute a stored procedure– You have SQL experience/experience building views– Have the SQL code ready to dump into a report
• Follow along with the Handout for step by step instructions
Creating a Report Without the Wizard
• Adding Basic Parameters– More than one way to add a parameter:
• Edit Query• Via Parameters in Report Data Pane
• Date Parameters– Different data types
Editing Reports
• When should you add a second dataset?– Creating a “Pick List” for a parameter
• Setting Available Values
• Cascading Parameters• Default Values• Multi-select Parameter
– IN NOT =
Editing Reports, cont.
Using the report you created in Lab 1:• Add a parameter to your report• Set default values for the parameter
Extra credit:• Using your custom table, or the name table, determine what
parameters could work together. – Examples: Region>Chapters, Member Type>Category, Company Member
Type>Member Type, etc.• Add a second dataset that queries for one parameter within the other
– Example: Select distinct demo_chapter.ChapterName where demo_chapter.region=@Region
Extra, extra credit:• Make one parameter multi-select
Lab 2
• Grouping– Best/easiest way is through wizard– Adding the Row Groups Pane is key– Using grouping to Drilldown in report– Adding a calculation within a group
• Adding headers and images• Using IF/THEN for conditional formatting
– =IIF(Fields!Fieldname.value=‘1’,’RED’,’GREEN’)– =IIF(RowNumber(Nothing) Mod2=0,”red”,”white”)
• Using Properties Pane to change fonts, colors, etc.• Using textbox properties to easily format numbers, etc.
Editing Reports, cont.
Using your existing report from Labs 1 and 2:• Add a header• Add your company logo in the header• Add grouping by one of your custom fields• Set up your report so that you can drilldown within your
field of choice• Use the Properties Pane to:
– Change font colors– Add conditional formatting to one of your custom fields– Alternate row colors
Lab 3
• Using General Lookup Validation Tables– Example (insert before last table join):
(SELECT CODE, DESCRIPTIONFROM Gen_Tables AS Gen_Tables_1WHERE (TABLE_NAME = 'CM_TYPE')) AS CMType ON
Demo_Communication.CM_TYPE = CMType.CODELEFT OUTER JOIN
Table Linking, cont.
• Create a new report with or without the wizard:• Use the following tables
– Name– 1 custom user defined table from your database
• Filter to only display records from one state of your choice• Join the Activity Table• Add a filter for a specific Activity Type of your choice
– Examples: Committee, Call, Gift• Add all activity information to report
– Display everyone from name table, regardless of whether or not they have row in activity table for your activity type
• *HINT* Remember the different types of joins• Group by one field from the activity table
Lab 4
• In a drilldown report, a user clicks a plus or minus button to expand or collapse a section of a report to show detail data in place. In a drill-through report, the user clicks a link for a summary value, and this opens a separate, related report to show detail data. The detail data is only retrieved when the detail report runs. Drill-through reports typically require fewer resources than drilldown reports.
• Remember: The report you click through TO must be created first
Drill down vs. Drill Through
• Follow along with Handout for step by step instructions• Remember: The names in the parameter list must match
the expected parameters in the target report exactly. – For example, parameter names must match by case. If the names
do not match, or if an expected parameter is not listed, the drill through report fails.
Advanced Report – Drill Through
• Create your own drill through report• Objective: Create an event report that displays all
registrants for an event of your choosing. When you click on the order number, you are able to drill through to the details of their registration.
• Create “To” report first that has all data from table– *HINT* use ORDER_LINES table
• Create “Main” report that has all registrants for a specific meeting– *HINT* use ORDER_MEET table
• Create drill-through action on order number of main report• Format your reports using the Properties Pane
Lab 5
• The UNION operator combines result-set of two or more SELECT statements
• Caveats– Each select in a UNION
must have the same number of columns
– Each column must have similar data types
– Columns in each SELECT statement must be in the same order
Advanced – Union Statements
• Deploy reports to report server:– Set target URL
under report project
– Deploy reports to server with 2 mouse clicks
Deploying Reports
• A Reporting Services subscription is a configuration that delivers a report at a specific time or in response to an event, and in a file format that you specify.
• Can create multiple subscriptions for a single report
• NOT available in every edition of SQL server
Using Subscriptions
• If/Then/Else– =IIF(Fields!Fieldname.value='Jupiter',’Planet’,’Not Planet’)– Can be used for conditional formatting in tangent with Properties Pane
• =IIF(Fields!Fieldname.value=‘1’,’RED’,’GREEN’)• Math
– Not Equal <>– Round =Round(1.3)– Sum =SUM(Fields!amount.value)– Count
• Today– Similar to getdate(), =Today()
• String Functions– Is one of IN(‘001’,’002’,’003’)– Is NOT one of NOT IN(‘001’,’002’,’003’)– Concatenation with carriage return =Fields!FirstName.value & vbCrLf &
Fields!LastName.value
Handy Formulas
• Do you have reports you need to build?• Do you have reports you have been trying to edit?• Do you need to add a formula or parameter to an existing
report?• What other questions do you have?
Lab Time
• Elizabeth WojcikEWojcik@csiinc.com
• Trisha HaasTHaas@csiinc.com
Questions?
Strategic Partners
Corporate PartnersAmericaneagle.com • Ascension Technology Solutions, LLC • Association Technologies, Inc. • Bursting Silver CadmiumCD • enSYNC Corporation • Informz • ISG Solutions • MemberPrime • RSM US LLP • Visual Antidote
Event PartnersArmstrong Enterprise Communications • Computer System Innovations • C Systems Global • iFINITY
Intuitive Business Concepts • Lane Services, LLC • Source of Knowledge (Official Recording Partner) • TGD Communications
Thank You To Our Sponsors