Walkthrough: Creating a Link from a Report to a Page
You can create reports that provide dynamic data with Visual Studio Report Designer and Microsoft Dynamics NAV 2016. Your reports can include images, graphics, toggles on data columns, interactive sorting, and links to other data in the system. This walkthrough illustrates how to set up a report to include a link to the Customer Card page. When the report is run in preview mode, you can look up any existing customer directly from the report. By including this functionality, you now have a report that is a dynamic list that you can use to drill down into data instead of a report that is a static, printed list.
About This Walkthrough
The walkthrough provides an overview of how to modify the Customer – Order Summary report to include a link to the Customer card. This walkthrough illustrates the following tasks:
Enabling hyperlinks on a report.
Adding a link to the customer name on the report using Visual Studio.
Running the modified report.
Prerequisites
To complete this walkthrough, you will need:
Microsoft Dynamics NAV 2016 with a developer license.
The CRONUS International Ltd. demo data company.
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 a page, you must enable hyperlinks on the report. For more information, see EnableHyperlinks Property.
To enable hyperlinks on a report
In the development environment, on the Tools menu, choose Object Designer.
In Object Designer, choose Report, select report 107, the Customer – Order Summary report, and then choose the Design button.
In Report Dataset Designer, select an empty line.
On the View menu, choose Properties.
In the Properties window, in the EnableHyperlinks field, select Yes.
On the File menu, choose Save In the Save dialog box, make sure Compile is selected and then choose the OK button to compile and save the report.
Adding a Link to Customer Name in Visual Studio
In the following procedure you add a link to the customer name on the report that opens the Customer card for the selected customer.
To add a link to customer name in Visual Studio
In the development environment, with the Customer – Order Summary report open in Report Dataset Designer, on the View menu, choose Layout.
In Visual Studio, in the Body section of the report, locate the First(Name_Cust) text box. The expression for the text box is
=First(Fields!Name_Cust.Value)
.Note
This report has two rows that contain the First(Name_Cust) text box. Only one row is displayed on the report. The row that is displayed depends on whether the user selects the Show Amounts in LCY check box in the request page. You must add the link to both of the text boxes that contain the customer name. This walkthrough only describes adding the link to one text box.
Right-click the text box, and then choose Properties.
In the Properties window, select the Action tab.
Select the Go to URL check box and enter the following line in the Select URL field:
="dynamicsnav://///runpage?page=21&$filter=Customer.'No.'%20IS%20'''%40" + Fields!No_Cust.Value + "*'''"
This opens page 21, the Customer Card page, and filters on which customer card to open.
In the Text Box Properties window, on the Font tab, under Color, choose ƒx to open the expression window.
Under Set expression for: Color, enter ="#0066dd".
Choose the OK button to close both windows.
Save the Report.rdlc file, and then close Visual Studio.
Running the Modified Report
In the development environment, you must now save the modified report and compile it you run it to see the changes.
To run the modified report
In the development environment, save the Customer – Order Summary 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.
Save and compile the report.
On the Windows taskbar, choose Start, and then choose Run.
In the Run window, enter the following text: dynamicsnav:////runreport?report=107, and then choose OK. For more information about the syntax for running a report from the Run window, see Creating and Running Hyperlinks.
Choose Preview to view the report. The report shows the order detail (the quantity not yet shipped) for each customer in three periods of 30 days each, starting from a selected date. If you select the customer name, then the specific Customer card opens. This makes it possible to drill down into the customer's data.
See Also
Tasks
Walkthrough: Designing a Report with Images, Interactive Sorting, and Visibility Toggle
Walkthrough: Designing a Customer List Report