10,3 Thêm Tính Fields cho báo cáo Crystal Report Mặc dù tạo ra báo cáo dựa trên các lĩnh vực được đưa ra trong bảng là tốt, nó chỉ không có sự linh hoạt tôi cần. Để có điều đó, tôi cần phải biết làm thế nào để thêm các lĩnh vực tính toán để báo cáo của tôi. | Add Calculated Fields to the Crystal Reports Report Although creating reports based on given fields in tables is fine it just does not give the flexibility I need. To have that I need to know how to add calculated fields to my reports. Technique In Crystal Reports calculated fields are known as formulas. To create and edit formulas you will use the Formula Editor see Figure . Figure . You can display this Formula Editor from either the Report Expert or the Report design. When you re in the Report Expert you can add a new formula by clicking on the Formula button located on the Fields tab. In Report design you can add a field by opening the Field Explorer located to the left of the IDE with the toolbox and expanding the Formula Fields tree. You can also right-click on the Formula Fields base node and choose New to add a new formula. Formulas are similar to T-SQL expressions in that you can combine fields or values with operators to create a Formula field. For example a formula called @TotalPricePerUnit is being created for this How-To. You saw it displayed in Figure . The expression used is this You can use Formula fields in summary sections and grand totals. The best way to verify a formula is to create it when you use the Report Expert to create a report. Steps Open the Visual Basic .NET-Chapter 10 solution. In the Solution Explorer you will see the report . Scroll over to the left so that the last column is visible. This is the Formula field. 1. Right-click on your project in the Solution Explorer and choose Add New Item from the Add menu item. Type the name of the report in the Name field and click Open. The Crystal Report Gallery dialog box opens. 2. Leaving the defaults as they are which is to use the Report Export and create a Standard report click the OK button. You are taken to the Report Expert with the Data tab displayed. 3. Double-click on the OLE DB ADO node in the Available Data