In Visual FoxPro for Windows versions 3.x and 5.x, just Sum the field and check the Currency check box in the Format dialog of the field (it appears under the Numeric category.) In the Format text box in the Report Expression dialog of the calculated field, use the following to format the output:
Of course, a report variable could also be used in Visual FoxPro.
Steps to Reproduce Behavior
Perform the following steps in FoxPro 2.6 for Windows:
- Open the Detail table located in the \tutorial directory.
- Set the order to the Ino tag.
- Create a new report and add the Price field to the Detail line.
- Add a Data Grouping to the report based on the Ino field.
- Add the Ino field to the Group Header and add a second field referencing Price in the Group Footer band.
- In the Price field in the Group Footer, click the Calculate check box, choose Sum and Reset on Detail.ino.
- In the Price field in the Detail and Group Footer bands, add the following code to the Expression box:
- Add a Report Variable to the report, xtotal, and set the Value to Store to Detail.price, Reset to Detail.ino, and Calculate to Sum.
- Add a new field to the Group Footer and use the Report Variable, xtotal, as the expression. Format as Currency if desired.
- Preview the report and notice that the calculated field is not preceded with a dollar sign and it carries the number out to five decimal places. However, the report variable field has the correct format.
- Open the Orders table located in the \Samples\Data folder.
- Create a report and add the orders table to the data environment.
- Set the order of the table to the Cust_id field using the Order property of the cursor in the data environment.
- Add a data grouping to the report based on the Cust_id field.
- Place the Cust_id field in the Group Header band and place the order_amt field in the Detail band. Double-click the field to bring up the Report Expression dialog box and in the Expression box, add the following code:Click OK to close the Report Expression dialog box.
- Copy this field into the Group Footer band. Double-click the field, choose the Calculations button, and select the button for Sum. Click OK to close the Report Expression dialog box.
- Preview the report. Note the non-calculated fields appear formatted correctly. However, the calculated fields appear as a row of asterisks.
Id. de artículo: 172849 - Última revisión: 06/19/2009 - Revisión: 1