Toad World® Forums

HTML Report Customization

Hello,

I have realized a package to customize reports HTML for the database Oracle,MySQL and Sql Server. But only, few case work fine: all Oracle reports, MySQL 5.0 reports and SQL SERVER 2005 reports. I suppose that i have a problem with my classes which extend the default classes…

My package is join to the post. If someone can help me, i work on this for a couple of days and I am disappointed with that…

Regards
AVEO_MS_MY.zip (49.4 KB)

Hi Martinez,
I see in your package 2 problems.

1) Relations between packages.
Your Package has extension on "Database Oracle" package, although it extended DB platforms Oracle, Microsoft SQL Server and MySQL. Minimal change you need to do is add extension relations on all three packages. I other case it can obtain situation, when your package don't be loaded for DB MySQL and Microsoft SQL.
In Attachment is Logical model with Three Packages Schemas. First you current schema, second schema is with minimal change and last is the most clearly schema. Your variant and Variant 2 has handicap. These variants required installing all three DB platform. If one of them don't be installed, so your package will not be loaded and during start Toad Data Modeler you get error message(Package cannot be loaded because parent package.... or something similar).
Unfortunately Toad Data Modeler has not GUI for modification relations between existing packages, you need manually edit package is XML document and you see on tag .

2) Now I began to focus on why it does not work, for example. MySQL 5.1. Other is the same principle.
In your Package has defined class BasicHTMLPERReportMY51 and it contains method ReportTableUserProperties. Unfortunately in system package "HTML Reports for MySQL 5.1" is class BasicHTMLPERReportMY51 with method ReportTableUserProperties too.Here is conflict. Both methods has same level and Toad Data Modeler can not determinate which method is first. When ReportTableUserProperties method is calling, will be choose first in internal list. Order in this list is "randomly". In your case is still calling method from system package.
Now I described what is wrong and I'll try to outline what to do. Don't create next instance of class BasicHTMLPERReportMY51, instead create class MyBasicHTMLPERReportMY51 and create generalization between BasicHTMLPERReportMY51 and MyBasicHTMLPERReportMY51(BasicHTMLPERReportMY51 is parent of MyBasicHTMLPERReportMY51)(viz Generalization.png). For differentiate from system report is good create method GetCaption (return type string). Implementation of this method:

function GetCaption()
{
return 'My Report';
};

Generazation.png

Generalization.png

If report is good loaded,then in Report wizard on frame "Select Report" will be in combobox caption "My Report". Of course it will not happen soon. There is one thing that I do not know if anyone has ever been mentioned.
However, I will describe it as a little Christmas present. :slight_smile:
Now you have class MyBasicHTMLPERReportMY51 and methods GetCaption, ReportTableUserProperties implemented in script MyBasicHTMLPERReportMY51(Important same name Script as Class). open dialog Script Properties (From Package explorer, script explorer or script editor) and set script category to HTML Report(viz. ScriptProperties.png). After Restart Toad Data Modeler "My Report" will be accessible in report wizard.

ScriptProperties.png

ScriptProperties.png

ReportWizard.png

ReportWizard.png

General algorithms for determinate what is class of report is from historical reasons this. First step is find all script with category HTML Report and it is valid for model(Oracle, PG...). Second step try search class with same name as script. And third step is delete all classes from which it inherits some other report class.

[View:/cfs-file/__key/communityserver-discussions-components-files/31/PacakgeSchema.zip:320:240]

Thanks a lot. After I rebuild my meta model with your recommendations, i have a new report entry and it's work with all different model.

My meta model looks that now: