probleme with SUM
hello,
I build a report and it was OK.
The only problem is that the footer was not all the time at the bottom of the page, depending on the row number of the detaildata band.
So I decided to add a child band with some vertical line on it, and I added this code on the footer obp event:
Now it seems to be OK concerning the position of the footer band, but a new problem occured: the sum on the footer band doesn't appear any more.
It seems that the child band printed between the detaildataband and the footer gives some trouble to the SUM
The sum code is : [SUM(<frxDBDataset2."LAPUMONTANT">,DetailData1)]
Regards
I build a report and it was OK.
The only problem is that the footer was not all the time at the bottom of the page, depending on the row number of the detaildata band.
So I decided to add a child band with some vertical line on it, and I added this code on the footer obp event:
procedure Footer1OnBeforePrint(Sender: TfrxComponent);
begin
while engine.freespace > (child1.height + footer1.height) do
begin
engine.showband(child1);
end;Â Â Â Â
end;
Now it seems to be OK concerning the position of the footer band, but a new problem occured: the sum on the footer band doesn't appear any more.
It seems that the child band printed between the detaildataband and the footer gives some trouble to the SUM
The sum code is : [SUM(<frxDBDataset2."LAPUMONTANT">,DetailData1)]
Regards
Comments
Here are the files.
For security reasons, i have removed information on header and footer
regards
I have found somebody who has the same trouble.
http://www.fast-report.com/en/forum/index....#092;.freespace
I did the same written in that post and it's working.
But it's very strange to put the reset of the variable on the Footer1OnAfterPrint event ?
For me it was more logical to put that code on the OnStartReport event, but it doesn't work, the variable result is multiplicated by 2 !!
Do someboby can explain that ?
Here is my code
regards
Yes the code works good.
But i'm just wondering why the code to reset the variable on the procedure OnStartReport doesn't work ?
It's strange for me to reset the variable at the end of the report ?
Regard
I set report totals in the OnBeforePrint event of a ReportTitle band. I don't use ReportTitle for anything else so I also set its height to 1 at run time.
I come back with this old post because I found a new problem.
The following code works good if engine.freespace > (child1.height + footer1.height)
But if the engine.freespace is lower than (child1.height + footer1.height) the footer is printed at the top of the following page [img]style_emoticons/<#EMO_DIR#>/mad.gif" style="vertical-align:middle" emoid="" border="0" alt="mad.gif" /> I think I need to write some code in the ?????? section (see below). I tried different possibilities but no result. What I want is to have the footer always at the same position: at the bottom of the page. The free space between detaildata and footer must be filled with empty line (child1). Or the page must be filled from the top to the bottom if the footer is printed on the following page.[/img]
Thank you
I may be wrong here but it may give you an idea why you have above problem,
OnStartReport refers to the start of building the report structure and not the start of content generation.
If you have a 2-pass report then the variable is initialized but not where you expect it, before content generation, resulting in doubled up values.
The question I have is: why not manage the positioning of the footer band in the same way the position of the ReportSummary band is managed, using CurY := <expression>? There are numerous examples in this forum of how that is done.