• Aucun résultat trouvé

Enter My Branch for the prompt

Dans le document Pro SQL Server 2005Reporting Services (Page 124-128)

Hyperlink Actions

3. Enter My Branch for the prompt

4. In the Available Values section, enter the following labels/values: Branch1 = Webserver1, Branch2 = Webserver2, and Branch3 = Webserver3.

5. Set the default value to be Webserver1.

6. Return to the Navigation tab for the Disciplinefield, and apply the new expression

="http://" & Parameters!Branch_URL.Value & "/" & Fields!DisciplineID.Value.

7. Preview the report. Notice that you have a new parameter drop-down list called My alue of Webserver1.

Note

Many expressions and report items are case-sensitive inside the Visual Studio environment. Often, if you receive an error indicating that a value is not valid, it will turn out to be that the case was incorrect.

With the URL location assigned to be that of the parameter Branch_URL, whenever a differ-ent branch is selected from the drop-down list, the appropriate server for that branch will be selected.

Jumping to a Report

Quite possibly the most useful hyperlink action in SSRS is the ability to link to another report, called a drill-through report, from a specified location within the current report. You have been working on two reports in this chapter, learning about many of the elements available.

Now let’s tie the two reports, Employee Listing and Employee Service Cost, together by creat-ing a hyperlink from one to another. You will also pass a parameter value along with the hyperlink to narrow the results of the Employee Service Cost report when it is called from the Employee Listing report. The parameter value will be EmployeeID.

To add the hyperlink action that links to the Employee Service Cost report, return to the Navigation tab, this time from the EmployeeID textbox within the Employee Listing report.

After clicking the Jump to Report button, a drop-down list appears with all the reports that are available in the current solution. If the report has already been deployed to the report server and is not in the current solution, you can use the relative path based on the target server that is defined in the project. In this example, the target server is http://hwc04/reportserver.

You could add the relative path to any report on the report server. In this case, select the EmployeeServiceCost.rdlreport, and then click the Parameters button. Choose the parameters that are populated when the report is selected; later in the “Setting Report Parameters with Stored Procedures” section, we will show how to add these parameters to the report. Choose EmployeeTblIDas the parameter, and assign its value as =Fields!EmpTblID.Value, which is a field in the Employee Listing report that has a corresponding value to the EmployeeTblIDparameter.

After applying the new action, if the EmployeeID textbox is clicked when previewing the Employee Listing report, the Employee Service Cost report will be called and the parameter passed, thus narrowing the dataset for that report to only that selected employee.

In addition to interactive sorting, another feature in SSRS has been long-awaited: the ability to have a Date control added as part of the report automatically when a datatype of DateTime is added as a report parameter. In SQL Server 2005, this is an enhancement that, though it was possible to easily code a Date control in a custom .NET form, many report design-ers wanted a standard control for their usdesign-ers in the browser. To see this new Date control, add a single line to your Employee Listing report query. This will be an addition to the WHEREclause as follows:

Where ChargeServiceStartDate Between @DateFrom and @DateTo

Figure 4-14. Long-awaited date controls for report parameters

After you add this line to the query, two report parameters are created, DateFromand DateTo.

If these parameters are set as string values, which by default they are, changing them to a datatype of DateTime in the Report Parameters dialog box will force them to display a graphical date picker control, as shown in Figure 4-14. Now when you run the report, you can actively select the service dates that will automatically narrow down or expand your employees in the Employee Listing report.

Adding Hyperlink Formatting and Tooltips

Before you save the new Employee Listing report, let’s add two formatting properties that will make the link more obvious as well as provide feedback on what will happen when the link is selected. The first task is to simply make the EmployeeIDfield resemble a hyperlink. Select the field, and apply an underline and color format of blue (see Figure 4-15).

Figure 4-15. Employee Listing report with visible hyperlinks

Next you will add a tooltip to the same field. Tooltips appear whenever a user hovers the cursor over the field, and they provide additional information. In this case, you will use one simply to show which report will be called when the EmployeeID box is clicked—the Employee Service Cost report. The ToolTipproperty is located in the Misc section of the Properties win-dow. After selecting the field, open the Properties box, and enter Employee Service Cost as the tooltip. Notice that the tooltip, like most other values, can be an expression as well as a literal string.

Note

Tooltips will not display in preview mode; the report must be deployed before they can be viewed in the browser.

It is possible to assign multiple parameter selections as input for the drill-through report.

Now that you are linking to the Employee Service Cost report, which will have multiple parame-ters, let’s take a closer look at how parameters and filters work together to deliver data to a report.

Dans le document Pro SQL Server 2005Reporting Services (Page 124-128)