SSRS Reporting Services & Architecture: Part I


SQL Server Reporting Services [SSRS] is Reporting system based on SQL Server. It provides a set of tools & services enabling us to create, manage, and deliver reports for entire organization. It is a Microsoft Product released in year 2000.

SSRS Architecture intentionally not given in the starting of article. Before looking on each component of architecture, I preferred to make practical approach to it. In the end of article Architecture has been explained.

Create SSRS Report

First of all go to MS SQL Server 2005=>SQL Server Business Intelligence Development Studio.

1.gif

Move to File=>New=>Project=>Report Server Project

2.gif

After creating new report project, we get two folders in Solution:-

Share Data Sources=>here we set database credentials.

Reports=>here we add report files

3.gif

SSRS Data Source

Right click on Shared Data Sources folder & add data source. Following window panel will be opened where we need to provide data server details & database name.

To confirm that defined database is successfully connected click on 'Test Connection'.

4.gif

5.gif

After successfully adding data source, we can add a report in Report folder. Right click on Report folder & Add-New-Report. Window panel will be opened. Select Report item & provide report name 'Header_Report'.

6.gif

SSRS Report Design

After adding new report, we see report has 3 sections in different Tabs:

  1. Data-Here we put SQL Query or Procedure to fetch data from database that we have to show on report.
  2. Layout-This is the designing section where we format report by dragging tables, rectangle, lines etc from Toolbox. And Data field on report from Dataset panel.
  3. Preview-This panel shows how the report will display to end user.

All these 3 section circled in below image.

7.gif

SSRS Toolbar

Before moving to design report just we can briefly go through Report Items available in Toolbox.

  1. Textbox: To add any custom text on report we use textbox.
  2. Line: Drawing line on report.
  3. Table: Creating a table having rows & columns, header & footer. We can format table according to our requirement.
  4. Image: Adding image to report.
  5. Chart: facilitate to add different type of charts to report.
  6. Subreport: We can add a report in another one report. Like having Header & Footer report on a report.

Toolbox items shown in below image:-

9.gif

Now I dragged 3 textboxes on report & put text 'Dhania Hospital', & 'Health is Wealth', & 'Bhiwani Haryana 127021' respectively.

10.gif

After previewing report in Preview tab, report will appear as shown below.

11.gif

After finishing Header_Report, now we are creating new report AdmittedPatientList.

12.gif

After adding new report, move to Data section of report. Select <New Data Set>. A new window Dataset will be opened. Here choose Command type [store proc or text query] we need to use to fetch data from database. Here in this report stored procedure USP_GET_INPATIENT_REPORT.

13.gif

After adding dataset, click on Run button to execute command to get data. Define Query Parameters window opened where we need to pass values to procedure parameters[@FROM_DATE,@TO_DATE etc.]

14.gif

After execution of command, data shown in below panel & Report Datasets occupied with data fields we have in USP_GET_INPATIENT_REPORT procedure.

15.gif

After adding dataset to report, now we move to design report. Move to Layout section of report & drag a table on it. As we drag a table we get 3 sections in it:-

  1. Header: here we put data that need to be shown header of report. We can have more than one row in header just by clicking on Header row & add new row.
  2. Details: this is the part of table where we drag data fields from dataset panel.
  3. Footer: here we add items we need to show in footer of report.

16.gif

SSRS Subreport

In this report I am adding subreport item to add Header in report. Sub report Header_Report that we created previously chosen in Subreport property.

17.gif

Now we are adding 2 more rows in header section of report by just right clicking on left most of header column.

18.gif

Report designer provide Expression Window to help developer to use different formula, functions, operations. We can directly drag any data field like patient name, address etc from Dataset window or just right click on any row cell & select EXPRESSION option.

EXPRESSION Window has been shown in below image

19.gif

By default table have 3 columns only so we can add more columns as requirements by right click to header of a column & option to add column in left or right of selected column.

We can merge no of columns to accommodate more space required for a field. For example in our current report we have to merge all columns in header section to put text 'List of in patient from X Date to Y Date'.

New row added in header section to put name of column name like S.No, Patient Name etc. To format text of cell just right click on cell & select PROPERTY. Here in property window we can set font size, font type etc.

20.gif

Row Formatting: To format a row we need to open property window of a row by just selecting row & right clicking it & go to Property option.
In property window we can set border font, type, back color, text alignment, padding etc.

Now we dragging data fields like patient name, address in detail section of table just below their corresponding headers like patient name address. It is shown in below image.

21.gif

Now report is ready to use. Move to Preview panel of report & pass required parameters [FROM_DATE, TO_DATE etc] of report.

22.gif

Publish SSRS Report on Report Server

After creation of report we need to publish it on report server so it could be available to end user.

To publish report on sever we need to set credential of report server. Go to property of Solution explorer as shown below image.

23.gif

In Property window set 'TargetServerURL' field with Report-Server [i.e. NSARORA] and report virtual folder [i.e. ReportServer$NSARORA].

Field 'TargetReportFolder' contain folder name in report server where published reports saved. In detail it is shown in below image.

24.gif

After making setting for report server credential now we can deploy reports on server.

25.gif

As deployment of report starts output window shows the deployment.

26.gif

Up Next
    Ebook Download
    View all
    Learn
    View all