Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to have total for detail and header records
Message
From
21/08/2007 23:33:01
 
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01249062
Message ID:
01249503
Views:
19
Then whats use of having a alias for detail band the save was achieved in FPD26 also. I thought it would work like in Crystal report.
Rajesh
>>I have a report where the order header and detail have relation. The report is grouped on orderno. The detail band has alias orderdtl. The report at the end has totals for fields from orderdtl and orderhdr table. The totals for table orderdtl are correct but the totals of orderhdr are multiplied by the numer of records in that order.
>>
>>Rajesh
>
>Report variables or expressions you mark as SUM are processed once for each detail record. However, here's a trick to get what you want:
>
>- Create a report variable called rnTotal, set the initial value to 0, the value to store to 0, and the calculate option to SUM
>
>- In the On Exit Expression of the Data Group Footer band, use the following:
>
>
>_VFP.SetVar('rnTotal', rnTotal + orderhdr.totalamt)
>
>
>- In your summary band, use rnTotal as the expression to print and do not put any calculate options on it. Just print it as is.
Previous
Reply
Map
View

Click here to load this message in the networking platform