Pro SQL Server 2012 Reporting Services

(sharon) #1
CHAPTER 13  CREATING REPORTS USING REPORT BUILDER 1.0, 2.0, AND 3.0

Figure 13-8. Pro SSRS data source view


In this case, you have already designed the query; however, Report Builder 1.0 includes its own
graphical query builder, so it is possible to develop the query on the fly, so to speak. The graphical query
designer is standard, with standard diagram, grid, SQL, and result panes. Clicking the New Named Query
button opens the Create Named Query window. In the SQL pane, we can paste the pre-existing Patient
Census query from Listing 13-1, and click in the blank diagram pane to automatically load the graphical
representation of the query. If you need to provide aliases for any fields, such as distinguishing the
common LastName fields from the employee and patient table, you can do that in the grid pane, as
shown in Figure 13-9, which also shows the query and all the joined tables. Alias the lastname field as
Pat_LastName for patient and Emp_LastName for employee. Otherwise, if there were common
references to lastname, the default alias would have been ExprX, where X is the number of common
references. You can do the same for the ubiquitous DSCR, used for descriptions, as in the Diag and
PatEMR tables. We have also created an alias for each of the tables. This cuts down on the typing and
makes the SQL easier to follow. You can alias the table names in the SQL section of the code or by Right-
Clicking in the header section of each table and selecting Properties. You can enter the alias in the Alias
section of the properties window.

Free download pdf