Recent

Author Topic: [Solved] lazreport : master/detail bands arranging issue  (Read 9471 times)

tawfiq-lz

  • New member
  • *
  • Posts: 5
Re: [Solved] lazreport : master/detail bands arranging issue
« Reply #15 on: July 19, 2021, 04:37:35 pm »
مرحبا الاخ كيتو
نعم انا اتكلم عربي و لكن لا استطيع ارسال الرسائل او الاجابة عنها ربما لاني مزلت جديد في الموقع
اذا شئت تواصل معي عبر الجيمايل
tawfiq.md22@gmail.com

kito

  • New Member
  • *
  • Posts: 37
Re: [Solved] lazreport : master/detail bands arranging issue
« Reply #16 on: July 22, 2021, 10:28:27 pm »
I use CurY and CurBottomY properties to keep Master data and Detail data together (this code is in OnBeginBand event of report):

Code: Pascal  [Select][+][-]
  1.   If Band.Name='MasterData1' then begin
  2.     If ((frRacun.Pages[0].CurY
  3.            + iMasterData1_Height
  4.            + iDetailData1_Height * DM.qIzvjestaj.FieldByName('kstavkeopis_cnt').AsInteger
  5.          ) > frRacun.Pages[0].CurBottomY)
  6.       then
  7.         Band.ForceNewPage:=True;
  8.   end;

after testing  it

in my case I just used :

Code: Pascal  [Select][+][-]
  1.  If ((frRacun.Pages[0].CurY
  2.            + iMasterData1_Height
  3.            + iDetailData1_Height
  4.          ) > frRacun.Pages[0].CurBottomY)
  5.       then
  6.         Band.ForceNewPage:=True;
  7.   end;

thank you very much  this is the  best solution ever  !

dseligo

  • Sr. Member
  • ****
  • Posts: 359
Re: [Solved] lazreport : master/detail bands arranging issue
« Reply #17 on: July 22, 2021, 11:29:33 pm »
It's OK if you have only one detail row.
In SQL query I calculate how many detail rows I have for each master row and then multiply it with iDetailData1_Height.

kito

  • New Member
  • *
  • Posts: 37
Re: [Solved] lazreport : master/detail bands arranging issue
« Reply #18 on: July 23, 2021, 12:34:02 am »
It's OK if you have only one detail row.
In SQL query I calculate how many detail rows I have for each master row and then multiply it with iDetailData1_Height.
No, I have multiple detail rows.  as I mentioned earlier I didn't want in my report to find any master header alone in the bottom of the page, your code works perfectly but there are a lot of blank space can be used for the next master and some of their detail data, so I edited the code to make sure if this part of page doesn't fit one master  +at least  one detail data then force new page , and I could never guess that without your instruction.
« Last Edit: July 24, 2021, 11:40:11 am by kito »

 

TinyPortal © 2005-2018