Conditionnal formatting in a report

Hi, My problem is simple: In a report, I need to print a picture. If the picture exists, I must show it with 3 others controls (lines, shapes, etc.). If the picture doesn’t exist (MyRec.MyPic.HASVALUE = FALSE). I need to hide those 3 controls. I know how to do it in a form: CurrForm.myCtrlName.VISIBLE := MyRec.MyPic.HASVALUE; But how can I do this directly it within a report? I tried CurrReport.myCtrlName.VISIBLE… but it doesn’t work! I could copy my section with the 3 changes and use the SHOWOUTPUT, but I’m looking for a more “direct” way to do this. Regards, David

Hi David, instead of setting the property visible to false (which obviously does not work…) you could simply asign empty values to the fields. Change the labels to textboxes and asign variables to the 3 labels you mention. In the OnAfterGet you asign the values to both the “label text variable” and the record fields depending on the HASVALUE of your image… a workaround that will in this case always show an empty space if your image does not exist. Saludos Nils

Hmmm… I totally understand your idea, but I don’t think it would work with shapes. I need to hide graphic elements (rectangles, lines, oval, etc.), not text. Please tell me if you have any other idea, Regards, David

What about two sections of the same type? One with all elements and one without the Objects, which should be hidden. And in the OnPreSection-Trigger of the first Section you say: CurrReport.ShowOutPut(MyRec.MyPic.Hasvalue) and of the second Section CurrReport.ShowOutPut( NOT MyRec.MyPic.Hasvalue). This should work. Greetings, Frank

David, just an idea without any warranty: Put 2 sections on the same hierarchical level into your report. In one you put the graphical elements. In the other you leave them out. In the OnPreSection triggers you just say: CurrReport.SHOWOUTPUT(ConditionalExpr) or CurrReport.SHOWOUTPUT(NOT ConditionalExpr) respectively.

quote:


Originally posted by FPulsfort
What about two sections of the same type?


OK, Frank, it´s your point.

David,

quote:


Hmmm… I totally understand your idea, but I don’t think it would work with shapes. I need to hide graphic elements (rectangles, lines, oval, etc.), not text.


In that case, 2 sections as proposed beforehand are the only feasable solution, and easy to implement… Saludos Nils

Thank you guys, I just wanted to avoid the duplication of my section, but I think I will have to do it this way.