Problem with summary

Hi

I have serious problem with fuction SUM in my reports.

Report has folowing bands:
Title, MasterData and Summary. I use script code to
align Summary band to bottom. This code looks like this:
         if Engine.FreeSpace < ReportSummary1.Height then
                Engine.NewPage;

       Engine.CurY := Engine.CurY + Engine.FreeSpace - ReportSummary1.Height - 1;

On Summary band, I've placed a text field with code
[SUM(<frxDBDataset1."NUMER">,MasterData1)]

When report fits one page, everything is ok (text field displays
correct summary), but when there are two pages, text field remains
empty!.

Take look at these pictures:
Good (one paged report)
Fastreport
Bad (two paged report, field with descritption "Sum" is empty)
Fastreport

If there is at least one item (from MasterData band) on second page
everything is ok again.
Fastreport


And when I remove the code to align Summary band,
everything is ok too.


Do you have any ideas what is going on?


Comments

  • edited 2:24PM
    wrote:
       if Engine.FreeSpace < ReportSummary1.Height then
                   Engine.NewPage;
    
          Engine.CurY := Engine.CurY + Engine.FreeSpace - ReportSummary1.Height - 1;
    
    The Problem in this code .
    FR counts the free place for PageSummary itself.
  • edited 2:24PM
    I dont understand.

    Can you clarify please ?

    This code chcecks if there is
    enough space for summary band.
    If not, the new page is created, and
    band is aligned to bottom.

  • edited 2:24PM
    You unnecessary to do this independent FR does this itself.
  • edited 2:24PM
    Do you thing there is another way to align
    Summary band to bottom ?

    That would be great.
  • gordkgordk St.Catherines On. Canada.
    edited 2:24PM
    two possible ways
    procedure ReportSummary1OnBeforePrint(Sender: TfrxComponent);
    begin
    if engine.freespace > reportsummary1.height then
    begin
    Engine.CurY := Engine.PageHeight -reportsummary1.height -pagefooter1.Height - 1;

    end;
    end;
    isummary stretxhes use
    procedure ReportSummary1OnAfterCalcHeight(Sender: TfrxComponent);

    begin
    Engine.CurY := Engine.PageHeight -reportsummary1.height -pagefooter1.Height - 1;
    end;
    ;)
  • edited 2:24PM
    Thank you.

    Solution #1 works for me ;)

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.