dcsimg

MSSQL Server Reporting Services: Reporting Services Basics: Create a Reusable Template Report - Page 8

October 18, 2004

15.  Click OK.

Now, let's add some more of the requested information to our footer through the use of Global variables and other expression components within the Value property of a couple of additional Textboxes.

16.  Insert another Textbox into the Page Footer section of the Layout area, to the right of the Textbox we added above.

17.  Click the Textbox just added, to ascertain that it is selected.

18.  Open the Properties window for the Textbox.

19.  In the Properties window, ensure that the settings shown in Table 5 are in place.

Property

Setting

Font:

FontStyle

Normal

FontFamily

Verdana Ref

FontSize

8pt

FontWeight

Normal

Can Grow

True

Can Shrink

True

Location:

Left

3.75in

Top

0.175in

Size:

Width

2in

Height

0.175in

Table 5: Textbox Properties Settings

Now we will add another global variable to the footer, using the Value setting within the Textbox Properties window whose settings we have modified.

20.  Click within the Value setting in the Textbox Properties window to select it.

21.  Click the selector button (the down arrow) that appears.

22.  Select <Expression ...> from the selector, as we did earlier.

The Edit Expression dialog appears.

23.  Type the following after the "=" ("equals") sign in the Expression area of the dialog:

="Title: " & 

24.  Click the "+" ("plus") sign to the immediate left of Globals under Fields on the left side of the Edit Expression dialog, to expand it, as we did before.

25.  Click ReportName under Globals to highlight it.

26.  Click the Append button.

The ReportName expression component appears in the Expression area of the dialog, just as UserID did earlier. The Edit Expression dialog should appear as depicted in Illustration 23.


Illustration 23: The Edit Expression Dialog with Our Additions

27.  Click OK.

We will add the final variable component to the footer, the page number information, next.

28.  Insert one more Textbox into the Page Footer section of the Layout area, to the right of the Textbox we added above to contain the Title information.

29.  Click the Textbox just added, to ascertain that it is selected.

30.  Open the Properties window for the Textbox.

31.  In the Properties window, ensure that the settings shown in Table 6 are in place.

Property

Setting

Font:

FontStyle

Normal

FontFamily

Verdana Ref

FontSize

8pt

FontWeight

Normal

Can Grow

True

Can Shrink

False

Location:

Left

7.5in

Top

0.175in

Size:

Width

1in

Height

0.175in

Table 6: Textbox Properties Settings

32.  Click within the Value setting in the Textbox Properties window to select it.

33.  Click the selector button (the down arrow) that appears.

34.  Select <Expression ...> from the selector, as we did earlier.

The Edit Expression dialog appears.

35.  Type the following after the "=" ("equals") sign in the Expression area of the dialog:

="Page " & 

36.  Click the "+" ("plus") sign to the immediate left of Globals under Fields on the left side of the Edit Expression dialog, to expand it, as we did before.

37.  Click PageNumber under Globals to highlight it.

38.  Click the Append button.

The PageNumber expression component appears in the Expression area of the dialog. We now need to provide for the "total number of pages" portion.

39.  Type the following, after the Global!PageNumber component we appended above, in the Expression area of the dialog:

& " of " & 

40.  Click TotalPages under Globals to highlight it.

41.  Click the Append button.

The TotalPages component is appended, and the Edit Expression dialog appears as shown in Illustration 24.


Illustration 24: The Edit Expression Dialog with Our Additions

42.  Click OK.

Let's check our work so far, and verify its effectiveness.

43.  Click the Preview tab atop the Report Designer.

The preview of our template report appears as depicted in Illustration 25.


Illustration 25: Preview of Our Template Report (75% Reduction)

All appears in order, and so we will save the report, and then locate it for use as a template, in the next section.

Save the Report Definition as a Template

We have created an "empty" report, with header and footer sections, that we wish to reuse in creating new reports going forward. Let's save the report in its original location, for safekeeping, and then save it again as reusable template, with the following steps.

1.  Click the Layout tab.

2.  Select File --> Save All from the main menu to save all our work to this point.

3.  Select File --> Save Template_DatabaseJournal.rdl As ....

The Save File As dialog appears.

4.  Navigate to the following directory (or similar, depending upon your local environment), where Reporting Services houses the template and wizard files it presents in the early steps of report creation:

C:\Program Files\Microsoft SQL Server\80\Tools\

	Report Designer\ProjectItems\ReportProject

The Save File As dialog appears similar to the one shown in Illustration 26.


Illustration 26: Saving the .Rdl File to the Template Directory

5.  Click Save to save the report file as a template.

6.  Select File --> Close to close the report.

Our template report is now positioned for reuse in prospective report creation.








The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers