Walkthrough: Creating a Link from a Report to a Report
This walkthrough illustrates how to set up a report to include a link from the Customer - Top 10 List report to the Customer - Detail Trial Bal. report. When you run the Customer - Top 10 List report in preview mode and show balance data, you can choose either a value in the Balance (LCY) column or a section of the pie chart to view detailed balance information. By including this functionality, you now have a dynamic report that enables you to drill down into data.
About This Walkthrough
This walkthrough illustrates the following tasks:
Enabling hyperlinks on a report.
Adding a link from the Balance text box on the report to another report.
Formatting the Balance text box to indicate that it is a link.
Adding a link from the pie chart to another report.
Running the modified report.
Prerequisites
To complete this walkthrough, you will need:
Microsoft Dynamics NAV 2016 with a developer license.
The CRONUS International Ltd. demonstration database.
Microsoft Visual Studio installed. For more information about which version of Microsoft Visual Studio you need, see System Requirements for Microsoft Dynamics NAV 2016. This walkthrough assumes that Microsoft Visual Studio 2012 or Microsoft Visual Studio 2013 is used.
Enabling Hyperlinks on a Report
Before you can add a link from a report to another report, you must enable hyperlinks on the report. For more information, see EnableHyperlinks Property.
To enable hyperlinks on a report
In the Microsoft Dynamics NAV 2016 Development Environment, on the Tools menu, choose Object Designer.
In Object Designer, choose Report, select report 111, the Customer - Top 10 List report, and then choose Design. The Report Dataset Designer window opens.
In Report Dataset Designer, select an empty row.
On the View menu, choose Properties.
In the Report - Properties window, in the EnableHyperlinks field, set the Value field to Yes.
From the File menu, choose Save, and in the Save dialog box, make sure Compile is selected and choose OK to compile and save the report.
Close the Properties and the Report Dataset Designer windows.
Adding a Link from the Balance Text Box
In the following procedure, you add a link from the balance text box in report 111, the Customer - Top 10 List report to report 104, the Customer Detail Trial Bal. report.
To add a link from the Balance Field
In Object Designer, choose Report, select report 111, the Customer - Top 10 List report, and then choose Design.
On the View menu, choose Layout. Visual Studio opens.
If you are opening Visual Studio from Microsoft Dynamics NAV for the first time you will choose your development environment. Otherwise, skip the next step.
In the Choose Your Development Default Environment window, select General Settings and choose Start Visual Studio.
In Visual Studio, choose the Report.rldc file to open it, and then in the Body section of the report, locate the BalanceLCY_Customer text box. The value of the text box is
=Fields!BalanceLCY_Customer.Value
. You can confirm this value by selecting the text box and viewing the Value property in the Visual Studio Properties window.Select the text box, and then from the shortcut menu, choose Text Box Properties.
In the Text Box Properties window, choose the Action tab.
Select the Go to URL check box and enter the following expression in the Select URL text box below the Go to URL check box:
="dynamicsnav:////runreport?report=104&filter=Customer.%22No.%22:"+Fields!No_Customer.Value
For more information about creating filters in a URL to run a report, see How to: Run Reports.
Choose OK to close the window.
On the File menu, choose Save Report.rdlc to save the report in Visual Studio.
Formatting the Balance Text Box
After adding the link from the balance text box to report 104, you may want to change the format of the balance text box to indicate that the data in the text box is a link. The following steps illustrate how to format the text box.
To format the Balance text box
In Visual Studio, in the Body section of the report, select the BalanceLCY_Customer text box.
On the View menu, choose Properties Window.
In the Properties window, in the Color field, select Blue. Expand Font and set Text Decoration, to Underline.
Save the report in Visual Studio.
Adding a Link from a Pie Chart
The following steps add a link from the data in the pie chart to report 111.
To add a link from a pie chart
In Visual Studio, select the pie chart, and then, from the shortcut menu, choose Series Properties.
In the Series Properties window, select the Action tab, then select Go to URL and enter the following expression in the Select URL text box below the Go to URL check box:
="dynamicsnav:////runreport?report=104 &filter=Customer.%22No.%22:"+Fields!No_Customer.Value
For more information about creating filters in a URL to run a report, see How to: Run Reports.
Choose the OK button to close the Series Properties window.
In Visual Studio, on the File menu, choose Save Report.rldc to save and then close the report in Visual Studio.
Running the Modified Report
In the development environment, you must now save the modified report and compile it before it you can run it.
To run the modified report
In the development environment, save the Customer - Top 10 List report.
A message informs you that the .rdlc file for this report has changed and asks if you want to load the changes. Choose Yes to save the changes in the database.
In the Save window, verify that the Compiled check box is selected, and then choose OK.
In the development environment , select the Customer - Top 10 List report and choose Run. The Edit-Customer- Top 10 List page for report 111 opens in the Microsoft Dynamics NAV Windows client.
Under Options, in the Show drop-down list box, select Balance (LCY) and in the Chart Type drop-down list box, select Pie chart.
Choose Preview to view the report. The report lists the top 10 list of customers. Notice that the Balance (LCY) column is formatted as a hyperlink. If you select the pie chart, you will notice that the chart is also formatted as hyperlink.
Choose a value in a Balance (LCY) column. The Customer - Detail Trial Bal. report for the specified customer opens.
Choose a sector in the pie chart that represents a customer. The Customer - Detail Trial Bal. report for the specified customer opens.
Alternatively, you can run the report from the Run window.
On the Windows taskbar, choose Start, and then choose Run.
In the Run window, enter the following text: dynamicsnav:////runreport?report=111, and then choose the OK button.
See Also
Tasks
Walkthrough: Creating a Link from a Report to a Page