Report.Template.SuppressErrorDialog is not applied to child reports
Hello,
I have been testing the property Report.Template.SuppressErrorDialog.
I set the value of the property and loaded the template from a stream:
Report.Template.SuppressErrorDialog := True;
Report.Template.LoadFromStream(lStream);
However I still got a warning "Unable to load BeforePrint...". After debugging the LoadError() method in ppTemplat.pas I have found out, that the value of the property does not seem to be transferred to child reports in the same template. While the main template has the property "SuppressErrorDialog" set to TRUE, the child report templates still have SuppressErrorDialog = FALSE. Therefore LoadError() still shows an error message when loading the child report template.
Is there a possibility to let ReportBuilder set the SuppressErrorDialog property of child reports automatically aswell?
Thanks in advance,
David Bakker
I have been testing the property Report.Template.SuppressErrorDialog.
I set the value of the property and loaded the template from a stream:
Report.Template.SuppressErrorDialog := True;
Report.Template.LoadFromStream(lStream);
However I still got a warning "Unable to load BeforePrint...". After debugging the LoadError() method in ppTemplat.pas I have found out, that the value of the property does not seem to be transferred to child reports in the same template. While the main template has the property "SuppressErrorDialog" set to TRUE, the child report templates still have SuppressErrorDialog = FALSE. Therefore LoadError() still shows an error message when loading the child report template.
Is there a possibility to let ReportBuilder set the SuppressErrorDialog property of child reports automatically aswell?
Thanks in advance,
David Bakker
Comments
Set Report.Template.IgnoreErrors True to ignore reader errors (the error is ignored, no dialog displayed, no exception raised)
Set SuppressErrorDialog True and IgnoreErrors False, when you want to use try...except to handle errors.
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
the property IgnoreErrorsTrue seems to have the same issue: The value of the property is not applied to child reports.
I. e. if the loaded report has child reports with errors, the error messages still appear.
I tested this when you originally posted and just tested again - including tracing thru the Delphi and RB source. RB uses the Delphi TReader and assigns an event-handler to TReader.OnError. There is only one TReader instance created - it reads the properties for the entire .rtm. There are some errors it can handle, when this happens it calls TReader.Error method which fires the OnError event. RB handles the event to suppress the error. There are other exceptions that TReader cannot handle, perhaps this is what you are encountering.
My test case is a main report with a subreport. The subreport has a label. I edited the .rtm to have a misspelled label property. This results in a property does not exist error that is suppressed by IgnoreErrors.
Try adding RBuilder\Source to the library path and build to include the Delphi debug .dcu's. Put a break point in TReader.Error.
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com