Quantcast
Viewing all articles
Browse latest Browse all 22

Part3: Creating a Custom SSMA Report

In the last part of this installment, I will show an example of SSRS report using the data we parsed in part 2 and extracted from SSMA in part1. For this report, I would like to list all projects and its aggregate conversion rate, number of object, and number of errors. If there are multiple runs of assessment for a given project, I only want to show the latest result.

Example of the report is as follows:

Image may be NSFW.
Clik here to view.
Part3_1_SummaryReport

clicking on “orcl_OE” project, would take you to the detail report:

Image may be NSFW.
Clik here to view.
Part3_2_DetailReport

For each of the report above, I created a stored procedure to define the query. I also created two views as follows:

CREATEVIEW vwLatestSSMAProjectSession AS
SELECT project, MAX(Session) asSessionfrom tblSSMAReport_Object GROUPBY Project
GO

CREATEVIEW vwSSMAReport AS
SELECT obj.Name,
obj.Path,
obj.Project,
obj.Session,
obj.Category AS ObjectCategory,
CAST(obj.ConvertedWithError as TINYINT) AS ObjStatus,
msgdtl.code,
msgdtl.description
FROM dbo.tblSSMAReport_Object obj
INNERJOIN dbo.vwLatestSSMAProjectSession ses on ses.Project = obj.Project and ses.Session = obj.Session
LEFTJOIN dbo.tblSSMAReport_MessageDetails msgdtl on msgdtl.ObjectID = obj.ObjectID and msgdtl.Project = obj.Project and msgdtl.Session = obj.Session
where obj.Name isnotnull
Go

vwLatestSSMAProjectSession identifies the latest session for each project. vwSSMAReport is the base query that join the data between the two tables created in part 2 and the view we just created. All the reports will use the same base query defines in this view to ensure consistency.

After the views are created, we can create the stored procedures:

CREATEPROCEDURE sproc_getReportSummary AS

SELECT Project,
Replace(Session,'report_','') ASSession,
COUNT(name) AS CountObject,
SUM(Status) AS CountError,
((COUNT(name) - SUM(Status)) *100 /COUNT(name)) AS ConversionRate
FROM
(
SELECT rpt.Name,
rpt.Project,
rpt.Session,
rpt.ObjectCategory,
COUNT(DISTINCT rpt.name) AS CountObject,
MAX( rpt.ObjStatus ) AS Status
FROM dbo.vwSSMAReport rpt
GROUPBY rpt.Project,
rpt.Session,
rpt.ObjectCategory,
rpt.Name
) Data
GROUPBY Project,
Session
ORDERBY ConversionRate DESC
Go

CREATEPROCEDURE sproc_getProjectDetail (@project varchar(255)) AS
SELECT Project,
Replace(Session,'report_','') ASSession,
ObjectCategory,
COUNT(name) AS CountObject,
SUM(Status) AS CountError,
((COUNT(name) - SUM(Status)) *100 /COUNT(name)) AS ConversionRate
FROM
(
SELECT rpt.Name,
rpt.Project,
rpt.Session,
rpt.ObjectCategory,
COUNT(DISTINCT rpt.name) AS CountObject,
MAX( rpt.ObjStatus ) AS Status
FROM dbo.vwSSMAReport rpt
WHERE rpt.Project = @project
GROUPBY rpt.Project,
rpt.Session,
rpt.ObjectCategory,
rpt.Name
) Data
GROUPBY Project,
Session,
ObjectCategory

Create the report using the Report Wizard and specify connection information to the SQL Server database:Image may be NSFW.
Clik here to view.
Part3_3_DataSource

Specify "execute sproc_getReportSummary" as the query string

Image may be NSFW.
Clik here to view.
Part3_4_DesignQuery

Accept the default Tabular report type:

Image may be NSFW.
Clik here to view.
clip_image001

Move all the fields to the "Details" section:

Image may be NSFW.
Clik here to view.
Part3_6_DesignTable

Choose the Table Style:

Image may be NSFW.
Clik here to view.
Part3_7_TableStyle

Name your report and click finish:

Image may be NSFW.
Clik here to view.
Part3_8_ReportName

From the design window, drag "Data Bar" from the toolbox window onto ConversionRate cell.

Image may be NSFW.
Clik here to view.
Part3_9_DataBar

Select the Data Bar Type

Image may be NSFW.
Clik here to view.
clip_image001[4]

Click on the bar to display chart data dialog box then click on the arrow next to the ConversionRate. Select "Show Data Labels"

Image may be NSFW.
Clik here to view.
Part3_11_DataBarLabel

To create the Project Detail report, repeat the process and use the following as query string: "execute sproc_getProjectDetail @project"

Image may be NSFW.
Clik here to view.
Part3_12_DesignQuery

Select the Report Type:

Image may be NSFW.
Clik here to view.
Part3_13_ReportType

Move ObjectCategory, CountObject, CountError, and ConversionRate to the Details section:

Image may be NSFW.
Clik here to view.
Part3_14_DesignTable

Select the Table Style

Image may be NSFW.
Clik here to view.
Part3_15_TableStyle

Name your report and click Finish:

Image may be NSFW.
Clik here to view.
Part3_16_ReportName

Return to the Report Summary, right click on the Project cell and select Text Box Properties:

Image may be NSFW.
Clik here to view.
Part3_17_ReportAction

Go to Action tab, select "Go to report", select the report name, and add parameter as follows:

Image may be NSFW.
Clik here to view.
image

Click the preview tab on the Project Summary report and click one of the project:

Image may be NSFW.
Clik here to view.
Part3_19_SummaryReport

The detail for the selected project should appear:

Image may be NSFW.
Clik here to view.
clip_image001[6]

This conclude our 3 part series on creating custom SSMA report. Please check out the previous related posting on this topic:

Part 1: Extracting SSMA results using SSIS

Part 2: Parsing SSMA XML files

Image may be NSFW.
Clik here to view.

Viewing all articles
Browse latest Browse all 22

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>