Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
10,5 Xác định nào Records sẽ in tại Runtime Tôi có thể sử dụng Wizard Chọn để giúp hạn chế các hồ sơ mà tôi muốn được hiển thị trên báo cáo, nhưng điều đó không làm người dùng của tôi nhiều tốt khi họ muốn kiểm soát là khi ứng dụng được chạy | 10.5 Determine Which Records Will Be Printed at Runtime I can use the Select Wizard to help limit the records that I want to be displayed on the report but that doesn t do my users much good when they want control over that when the application is running. How do I determine which records are displayed at runtime Technique To handle this use the SelectionFormula of the CrystalReportsViewer. When you use the SelectionFormula to limit your records you are taking advantage of Crystal Report s Database optimization. This means that the query you generated by setting the SelectionFormula and the original record source for the report will be pushed down to the server. SelectionFormula Syntax You can see the syntax for the SelectionFormula here CrystalReportViewer1.SelectionFormula Table.Field value Value can be various data types delimited by the usual delimiters such as single quotes for strings. For the new criteria to take effect after setting the SelectionFormula you need to call the RefreshReport method of the CrystalReportViewer. Setting Report Options To get optimal use out of the SelectionFormula you need to keep some things in mind. You need to set an option of the report that will ensure it uses the record source indexes if possible. To do this you right-click on the report and choose Report Options from the Report menu. On the Options page make sure to check Use Indexes or Server for Speed see Figure 10.20 . Figure 10.20. Customize your report by using the Report Options dialog box. Another tip is to make sure you use indexed fields whenever possible. Tip Take some time now to check out some of the other report options. Steps Open and run the Visual Basic .NET-Chapter 10 solution. Click on the button labeled How-To 10.5. You can select Regions from the ComboBox control on the top of the form the report then reflects the selection see Figure 10.21 . 1. Create a Windows Form. 2. Drag on a ReportDocument object and set it to point to the report you created in .