Recent

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

kito

  • Jr. Member
  • **
  • Posts: 78
Hello
I Have a datasets in a master detail relationship and I am facing two problems showing it properly with lazreport .
*The first issue : master header in certain cases appears in the bottom of the page and their details in the next page . and showing each master  header in new page wont help in my case .

*The second issue : at the end of the table I used a master footer band with script visible at the end of the last page witch also  some times appears lonely  in the head of the last page because there are no free space left in the previous page .

I would appreciate any help even a short hints  :)  .
« Last Edit: April 12, 2020, 08:46:49 pm by kito »
We can barely feel your presence, because of the depth of your silence

kito

  • Jr. Member
  • **
  • Posts: 78
Re: lazreport : master/detail bands arranging issue
« Reply #1 on: November 11, 2019, 10:04:30 pm »
hello again it has been 120 days since posting this  :-[  and it's all my bad I couldn't explain the issue clearly so I upload this image hopefully it clarifies better the problem, I need to keep both detail header band and détail data band in the same page and avoid printing detail header alone in the bottom of the page in some cases when it doesn't suit it.

https://www13.0zz0.com/2019/11/11/23/459894945.png

(https://www13.0zz0.com/2019/11/11/23/459894945.png)

We can barely feel your presence, because of the depth of your silence

GAN

  • Sr. Member
  • ****
  • Posts: 370
Re: lazreport : master/detail bands arranging issue
« Reply #2 on: November 11, 2019, 10:48:04 pm »
Right click the header band and you find a few options that may be help you.
Lazarus 2.0.8 FPC 3.0.4 Linux Mint Mate 19.3
Zeos 7̶.̶2̶.̶6̶ 7.1.3a-stable - Sqlite 3.32.3 - LazReport

kito

  • Jr. Member
  • **
  • Posts: 78
Re: lazreport : master/detail bands arranging issue
« Reply #3 on: November 12, 2019, 12:03:20 am »
Right click the header band and you find a few options that may be help you.
thanks GAN for your reply, I already tried  every single option nothing changes except if I select force new page which doesn't  solve the issue it made every single detail table shows in a separate page .
We can barely feel your presence, because of the depth of your silence

GAN

  • Sr. Member
  • ****
  • Posts: 370
Re: lazreport : master/detail bands arranging issue
« Reply #4 on: November 12, 2019, 12:38:48 am »
You can try using groups instead of master/detail.
Here is the manual of FastReport that is very similar, check it https://www.fast-report.com/public_download/UserManual-en.pdf
Lazarus 2.0.8 FPC 3.0.4 Linux Mint Mate 19.3
Zeos 7̶.̶2̶.̶6̶ 7.1.3a-stable - Sqlite 3.32.3 - LazReport

kito

  • Jr. Member
  • **
  • Posts: 78
Re: lazreport : master/detail bands arranging issue
« Reply #5 on: December 04, 2019, 09:06:56 pm »
You can try using groups instead of master/detail.
Here is the manual of FastReport that is very similar, check it https://www.fast-report.com/public_download/UserManual-en.pdf
I really appreciate your time and your suggestions, I tried  what the manual said and I made some changes to my project  but nothing changes I did check every step   :(
We can barely feel your presence, because of the depth of your silence

kito

  • Jr. Member
  • **
  • Posts: 78
Re: lazreport : master/detail bands arranging issue
« Reply #6 on: February 12, 2020, 02:48:30 am »
I somehow found a solution it's very awful  ::), but at least it did solve my problem.
in lazreport I made a single master data band and I counted how many rows needed to fill all the page which was in my case 59 .
I made a temp table as an Adapter, I fill on it all my mater data/ detail fields successively
using two loops blocks . inside the master loop block, I made a check if (line mod 59 = 0) then insert an empty line which will eventually push this last line to a new page  and  VOILA, thank you GAN I hope you see this reply
We can barely feel your presence, because of the depth of your silence

GAN

  • Sr. Member
  • ****
  • Posts: 370
Re: lazreport : master/detail bands arranging issue
« Reply #7 on: February 12, 2020, 03:01:16 am »
Hi @kiko thanks for share the solution you found. LazResport is great, but you need time and a lot of tests.

Regards,
GAN.

May you edit the subject of the post and add (Solved)?
« Last Edit: February 12, 2020, 03:02:55 am by GAN »
Lazarus 2.0.8 FPC 3.0.4 Linux Mint Mate 19.3
Zeos 7̶.̶2̶.̶6̶ 7.1.3a-stable - Sqlite 3.32.3 - LazReport

tawfiq-lz

  • Newbie
  • Posts: 5
Re: [Solved] lazreport : master/detail bands arranging issue
« Reply #8 on: July 14, 2021, 05:45:39 pm »
can you please tell me how did you get the rows number in the header ??

kito

  • Jr. Member
  • **
  • Posts: 78
Re: [Solved] lazreport : master/detail bands arranging issue
« Reply #9 on: July 14, 2021, 08:50:42 pm »
Hello tawfiq, I am not sure what you mean by the header?  Page header or master header or detail header?
We can barely feel your presence, because of the depth of your silence

dseligo

  • Hero Member
  • *****
  • Posts: 1194
Re: [Solved] lazreport : master/detail bands arranging issue
« Reply #10 on: July 15, 2021, 10:45:17 am »
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;

tawfiq-lz

  • Newbie
  • Posts: 5
Re: [Solved] lazreport : master/detail bands arranging issue
« Reply #11 on: July 15, 2021, 04:32:56 pm »
Hello tawfiq, I am not sure what you mean by the header?  Page header or master header or detail header?
hello kito and thank you for the feedback ,
so for now i need it in the group header , but i asked for it in any header cuz i thoughts its the same thing , the total always gave me "0" in any header but it gave me the real total in any footer .

kito

  • Jr. Member
  • **
  • Posts: 78
Re: [Solved] lazreport : master/detail bands arranging issue
« Reply #12 on: July 17, 2021, 12:11:11 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;

Hello dseligo  , I will try this and I'll let you know 
We can barely feel your presence, because of the depth of your silence

kito

  • Jr. Member
  • **
  • Posts: 78
Re: [Solved] lazreport : master/detail bands arranging issue
« Reply #13 on: July 17, 2021, 12:57:36 pm »
Hello tawfiq, I am not sure what you mean by the header?  Page header or master header or detail header?
hello kito and thank you for the feedback ,
so for now i need it in the group header , but i asked for it in any header cuz i thoughts its the same thing , the total always gave me "0" in any header but it gave me the real total in any footer .
I will gladly try to give you a hint according to my slight experience, but I recommended opening a new topic
to get more professional suggestions and answers also  to make easy if someone else had the same problem can find easily and separately the solution .

well in similar situations if I can  get the Total before loading the report, I will use a variable x (integer or string )
and a query(Q) to get  the total ( select Sum () where ..... and ....) and assign the result with the variable

Code: Pascal  [Select][+][-]
  1. x := Q.sum.asstring ; ( it's not a correct code just an exemple )

open the report designer and create a variable and don't give it any value let name it Total
https://ibb.co/PWGrpzS

https://ibb.co/6gfQ2mV

place the variable (total) [Total] in the tagged band save and exit the report_designer

finnally in  the frReport  GetValue evants :

Code: Pascal  [Select][+][-]
  1.   if ParName= 'Total' then ParValue:=x ;

and that's it , if you need to update the Total each time just close then open the Query

 

We can barely feel your presence, because of the depth of your silence

tawfiq-lz

  • Newbie
  • Posts: 5
Re: [Solved] lazreport : master/detail bands arranging issue
« Reply #14 on: July 19, 2021, 03:12:30 pm »
Thanx for the effort Mr kito , i did open a new topic about that problem before asking here , but still get no helpful answers , and i tried with a query to get the total for each group but it alwas gave me the total of all the report , i think the solution need to be done programmatically with the report functions and procedures like ( report.endband ,report.beginband ...etc ).
in FastReport there is a solution called "ProcessAt" that allowed you go back above to any headers and put the total of MasterData there .
« Last Edit: July 19, 2021, 05:00:22 pm by tawfiq-lz »

 

TinyPortal © 2005-2018