Building Reports in SQL Server 2005—Adding a Bookmark Link

Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio


Jump to: navigation, search
CSharp-Online.NET:Articles
Database Articles

Building Reports

© 2006 R. Landrum, W. J. Voytek

Adding a Bookmark Link

In this section, you will add a bookmark link to the Employee_Name field in the Employee Listing report that, when clicked, will jump to a defined location within the report. In this case, you will not add another Table data region to the report to contain detail information about employee visits. Bookmarks ease the navigation burden on large reports when users are looking for specific information. As discussed previously, summary and detail information can exist within the same report; in the case of adding a bookmark, you are not hiding the data so much as moving it to another location within the same report. The net effect for the user is the same, however, in that they control when they see the detail information.

To add a bookmark to the Employee Listing report, first follow the procedure to drag a new table element to the Layout tab. Next, add the patient name and the trimmed employee name. For this table you will want to group by the employee name, so right-click your detail row and select Insert Group. You will use the same trimmed expression as the group value expression, as follows:

=rtrim(Fields!LastName.Value) & ", " & rtrim( Fields!FirstName.Value)

On the General tab for the grouping, select Page Break at End, which will force the detail line for each employee to start on a new page. Next, add the date field that represents when the service was performed, =Fields!ChargeServiceStartDate.Value, to the third column, and format the date as you did earlier.

Now when you preview the report, the summary employee listing will appear on the first page, and the detail records that show the employee visits will appear on each subsequent page.

Next, you will add a BookmarkID field to the Employee_Name field in the detail row in the table. By right-clicking the field and selecting Properties -> Advanced, you can view the Navigation tab that controls all three hyperlink actions. In the BookmarkID field, you will again add your trimmed employee name expression. This will serve as the pointer record for the bookmark link you will now create.

To create the bookmark link, you will perform the same steps to get to the Navigation tab for the Employee_Name field in the first table. In the Hyperlink Action section of the tab, select Jump to Bookmark and paste in the trimmed employee name expression you used for BookmarkID.

■Tip Hyperlink actions do not automatically change the formatting of the field to indicate an associated hyperlink. You can manually change the color and add underline formatting so that the user knows to click the link.

When you preview the report, as shown in Figure 4-12, you see the detailed information for the selected employee, in this case Sojourner Truth, presented on page 2; the first page of the report is the Employee Listing table, where you clicked on the bookmark link in the Employee_Name field.



Figure 4-12. Employee visit detail report called from a bookmark link


Previous_Page_.gif Next_Page_.gif


Personal tools