QUOTE(gordk @ Oct 18 2011, 02:42 AM)

i would like to see the code from the reports code page.
This is the relevant code.
- totphono is the running total
- The variable "ligne" helped me see the OBP was called twice for some records.
- The frxMVEN.idtmpven / lastligne is a serialization (workaround) I added to make sure my total was counted only once
CODE
procedure MasterData2OnBeforePrint(Sender: TfrxComponent);
begin
ligne:=ligne+1;
with MasterData2, Engine do
begin
if <frxMVEN."idtmpven"> <> lastLigne then begin
totphono:=totphono+<frxMVEN."brutad">;
// other calculations not involving totphono
lastligne:=<frxMVEN."idtmpven">;
end;
end
end;
QUOTE(gordk @ Oct 18 2011, 02:42 AM)

Also where is the memo located that you are printing the variable value? ie which band?
The report is a little complex, I will try to make it clear how it's supposed to work :
Main report contains :
- MasterBand1
- DetailBand1 (contains subreport1 and only subreport1)
- totphono is reset to zero in DetailBand1's OBP
- Child2 (child of DetailBand1) : this is where the "totphono" value is printed
SubReport1 contains :
- GroupHeader1 based on DetailBand1's datasource (printed when DB1 changes)
- GroupHeader3 based on MasterData2's datasource
- MasterData2 : his OBP is called twice sometimes
- Child1 linked to MasterData2, only printed when report is in "debug" mode (prints more details). Since this changes the layout, it also changes the total.
- GroupFooter3 (no totals printed but stretchable because text can be long)
- Child14 linked to GroupFooter3 : just a horizontalline that must be printed underneath GF3
- GroupFooter1 (counterpart of GroupHeader1). This prints a sum(<frxMVEN."brutad">) which is correct (and how I found the bug)
If I print "totphono" on the MasterData2 line, I see the running total and on top of "some"pages, I can see that the last value has been added twice
QUOTE(gordk @ Oct 18 2011, 02:42 AM)

Note: there are some cases where it is better to increment a variable in the obp of the memoview rather than the band.
Also tried this but didn't help, the memo's OBP is called twice also.
Let me know if you want me to send you the .FR3 or a PDF demonstrating the bug.