Hello there,
This is my first post on this forum so i will be descriptive.
I am using visual foxpro 9.0 sp1 with postgresql 8.1 for the db, i get the base of my report with sql result. The report that i do need sub-totals based on the customer changes.
So i have a table of all records which is indexed based on the customer. When it changes i print the subtotals. This table has 5 - 8 child tables (details of customer, details of tariffs, general total, etc )
I have created few variable to do the sub totals (pieces, weight, ..) but the result is for example:
1 subtotal is following only 1 line of 1 piece, 0.7 kg the sub totals will be 2 pieces and 1.4 kg. Depending of the number of records processed the subtotal is not multiple of 2 but 1.5X or 3X. It is not times the number of records.I made the variable reseted based on the customer grouping.
It seams that it is based on the number of child table processed. But i am not able to eliminates all the child table. If i only have 1 table without child the subtotal is correct.
Please help because up to now i am creating other table with sub totals preprocessed.
Thanks for all idea. Best regards. Bran

Report Variable : sub totals are multiplied by times the report is randered
Felipe Gaiotto
Thank you Gianni for your response, I will try tonight.
Altaff
Hi Bran,
you can find a similar discussion here:
VFP9 wrong totals/subtotals in reports with multiple detail bands and group subtotals and/or summary totals
Use these report variables, keeping LastRecno as the last line in the Report Variables list.
Variable name: Total1
Value to store: iif(recno() # LastRecno, <expression 1 you want to total>, 0)
Initial Value: 0
Reset value based on: <your group 1>
Calculation type: Sum
Variable name: Total2
Value to store: iif(recno() # LastRecno, <expression 2 you want to total>, 0)
Initial Value: 0
Reset value based on: <your group 2>
Calculation type: Sum
Variable name: LastRecno
Value to Store: recno()
Initial Value: 0
Reset value based on: Report
Calculation type: None
The Total variable is adding up the value of the field you want to sum, but only when the record has changed in the first detail band.
The LastRecno variable is tracking the last value of recno() for the table in the first detail band.
When you're processing the second detail band, the record pointer doesn't move in the first detail band table and nothing gets added.
Thanks to Tamar Granor!
Gianni