Recent

Author Topic: LazReport: How to hide a band if ZeroValue?  (Read 956 times)

Focus77

  • New Member
  • *
  • Posts: 25
LazReport: How to hide a band if ZeroValue?
« on: July 02, 2020, 10:23:50 pm »
Hi every one.

I have a LazRepot with a band(SubDetailFooter1) and 2 memo on it.

The memo1 is a label.
The memo2 is integer

If the memo2 is zero, how to hide the band?

Thank a lot.   
My goal is to make a web Application
using HTTPServer

WimS

  • Newbie
  • Posts: 4
Re: LazReport: How to hide a band if ZeroValue?
« Reply #1 on: July 21, 2020, 07:35:00 pm »
I did the following:

on the OnBeginBand of the report I wrote the following:


  if (Band.Name = 'BandToelichting')       // 'Bandtoelichting is the name of the band you want to hide
   then begin
          if trim(SQLQueryReport.FieldByName('Toelichting').asString)='' / test for hiding or not
             then begin
                    //Band.Visible:=false // this didn't work
                    Band.Height := 0;        // hide band
                  end
             else begin
                    Band.Height:=22;        // show the band and because stretched = true all is printed
                  end;
          Exit;
        end;


First I stated with making the band visible or not, but that gave problems with child bands.

I hope it helped you and if there is a better way, where can I find the documentation, it's a lot try and error now.

best regards WimS

 

TinyPortal © 2005-2018