Recent

Author Topic: [Solved] Lazreport - How to really make duplicates disappear  (Read 951 times)

janhsh

  • New Member
  • *
  • Posts: 17
    • http://www.houbart.be
[Solved] Lazreport - How to really make duplicates disappear
« on: August 06, 2024, 03:35:06 am »
Hello
I have a problem with lazreport
I created a "Master data" band with a field A, and a child band with a field B. Both fields are in the same dataset

My display is as follows

A Value 1
B value 1.1
A Value 1
B value 1.2
A Value 1
B value 1.3
A Value 2
B value 2.1
A Value 2
B value 2.2

When I set HideDuplicates=True, the display becomes

A Value 1
B value 1.1
(Blank line)
B value 1.2
(Blank line)
B value 1.3
A Value 2
B value 2.1
(Blank line)
B value 2.2
                           

I would like to make these white lines disappear to obtain

A Value 1
B value 1.1
B value 1.2
B value 1.3
A Value 2
B value 2.1
B value 2.2
         

I tried with a script to reduce the size of the "Master data" band when the A field is not visible, but it doesn't work


How can I do this?
« Last Edit: August 16, 2024, 04:59:17 pm by janhsh »

GAN

  • Sr. Member
  • ****
  • Posts: 375
Re: Lazreport - How to really make duplicates disappear
« Reply #1 on: August 06, 2024, 04:16:59 am »
Hello, I had similar issue and I solved using the event handler frRepBeginBand, there i can manage the heigth of the band. May be this help you.

Code: Pascal  [Select][+][-]
  1. procedure TFLibCompras.frRepBeginBand(Band: TfrBand);
  2. begin
  3.   if ((Band.Name='MasterData1') and (ZQ.FieldByName('cnetogravado2').AsCurrency<>0)) then
  4.   begin
  5.     Band.Height:=45;
  6.     Exit;
  7.   end;
  8.   if ((Band.Name='MasterData1') and (ZQ.FieldByName('cnetogravado1').AsCurrency<>0)) then
  9.   begin
  10.     Band.Height:=30;
  11.     Exit;
  12.   end;
  13.   if ((Band.Name='MasterData1') and (ZQ.FieldByName('cnetogravado1').AsCurrency=0)) then
  14.   begin
  15.     Band.Height:=14;
  16.     Exit;
  17.   end;
  18. end;
  19.  
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

paweld

  • Hero Member
  • *****
  • Posts: 1187
Re: Lazreport - How to really make duplicates disappear
« Reply #2 on: August 06, 2024, 06:46:55 am »
use grouping. to the report you add a Master data band with a field with value B, add a Group header band with a condition for value A, and on this band you put a field with value A. Sample in attachment.
Best regards / Pozdrawiam
paweld

janhsh

  • New Member
  • *
  • Posts: 17
    • http://www.houbart.be
Re: Lazreport - How to really make duplicates disappear
« Reply #3 on: August 07, 2024, 01:08:45 am »

For layout reasons, I placed this part in a subreport. Grouping does not seem to work with a subreport.

 

TinyPortal © 2005-2018