Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

suppress group+detail based on dbcalc with lookahead.

edited March 2012 in General
Hi
I guess it is possible to supress the groupheader-, detail- and
groupfooter-bands based upon a dbcalc with lookahead, but I dont know
where to put the code.
I have tried to set the bands visibility in the BeforePrint and/or
BeforeGenerate events of the groupheaderband, but I dont get the
expected result.

My wish is to hide an entire group if the sum of a currency-field is zero.

Regards
René Laursen / SSV

Comments

  • edited March 2012
    Hi Rene,

    Attempting to hide the entire band in the BeforePrint/Generate is likely
    too late.

    Rather than hiding the entire band(s) themselves, try hiding the
    components inside the band. Placing the components inside a region
    would make this easier. Also be sure the band's print height is set to
    phdynamic.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited March 2012
    Hi Nico

    Thanks. But it still doesn't work the expected way.

    I have a dbcalc1 with lookahead=true on the groupheader (inside Region1)
    and the groupheader has this event:

    procedure TfmDimRap.ppReport1GroupHeaderBand1BeforePrint(Sender: TObject);
    begin
    inherited;

    dumpdouble('ppDBcalc1',ppDBcalc1.value);

    ppRegion1.visible:= ppDBcalc1.value<>0;
    ppRegion2.visible:= ppDBcalc1.value<>0;
    ppRegion3.visible:= ppDBcalc1.value<>0;

    dumpbool('ppRegion1.visible',ppRegion1.visible);
    end;

    The problem is that the dumped value (ppDBcalc1.value) will have the
    value from the first detail, while the printed value is 0 ?

    What am I doing wrong ?

    Best Regards René/SSV




    Den 08-03-2012 15:38, Nico Cizik (Digital Metaphors) skrev:
  • edited March 2012
    Hi Rene,

    Take a look at the following article on how to use lookahead values.

    http://www.digital-metaphors.com/rbWiki/Delphi_Code/Calculations/How_To...Use_a_Look_Ahead_Value_in_a_Calculation

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited March 2012
    Thanks !

    Den 09-03-2012 15:34, Nico Cizik (Digital Metaphors) skrev:
This discussion has been closed.