You are reading help file online using chmlib.com
|
Rave Reports Developer Guide Hiding Bands or Components . |
Top Previous Next |
QUESTION: How do I hide a band based upon a DataText value?
SOLUTION: The solution depends upon what version of Rave Reports you are using.
1) The recommended method is to use the "Visible" property which was added to Rave Reports (5.11 or later) on almost all of the components, including the band components. The description of this property is that it "determines whether the component will be printed or not. Typically, set through scripting in the OnBeforePrint or OnBeforeReport events". You do this by putting a script that sets the "visible" property in a parent of the component you want to control (or in another component). Do not put a script that changes visibility in the same component you want want to control as it will run until it is "false" but will not run after that as both the component and event "are no longer visible". This example shows a header band event that is controlling the visibility of a row footer band.
{ Event for HeaderBand.OnBeforePrint } function Header_OnBeforePrint(Self: TRaveBand); begin if DvInventoryOnHand.AsInteger > 0 then BandRowFooter.visible := True; elseif DvInventoryOnHand.AsInteger = 0 then BandRowFooter.visible := False; else BandRowFooter.visible := True; end if; end OnBeforePrint;
2) For versions of Rave Reports that do not have the “Visible“ property, conditional hiding of bands can be accomplished through the use of data mirrors. To do this, drop down a couple of sections on a global page or second report page and place all of your components that need to be printed in the first section. The second section is left blank and its height is set to zero. Then on your main report page you drop down a DataMirrorSection component inside your band and set it up so that it either mirrors the empty section or the section with your components on it. Set the DataMirrorSection's height to zero and then based on a parameter or field in your database you mirror the appropriate section.
However, be aware that mirroring regions and bands can lead to “Page State” conflicts with unpredictable results.
|
You are reading help file online using chmlib.com
|