Property in custom Package not working from „Command Line“

I already replied to another very old post. But I think it might gets no attention because it is already answered. Generate HTML/PDF reports from the cmd-line - #3 by Andre

Because of that I created this new post for my question:

I created a custom package where I am able to modify the HTML report that will be generated. My new class depends on the BasicHTMLPERReportOR19. The Metamodel of my custom package also includes additional properties. On of the properties (config) will be assigned to an „object“ looking like that:

var config = {
  prop1: 'some value',
  prop2: true

In the function HTMLReport (see linked post) I assign the object to my property using:

Report.config = config;

If I run the script from inside the Application (Script Editor), I can access the property in my custom package.

If I run from the command line (using the linked example), I get an error that the properties is unknown. It shows the exact line in my custom package script, so the package itself is available.

Is there something I need to do related to the custom packages if I run from the command line?

I think that reason can be, that your package is not loaded.
Please check your links in the package. It should have one extension to Database Oracle 19 or HTML Reports for Oracle 19c.



Hey Daril,

thank your for your reply.

Here are some more details:

If I run my script (slightly modified because no ActiveXObject is needed) from the already launched Application from the Script Editor it runs fine and the Properties can be used.
The package is loaded in the Package Explorer.

If I run my script from command line (Using ActiveX, JScript and Cscript.exe) with the application closed before the code "jumps" into my custom package but cant access the property.

If I run my script from command line (Using ActiveX, JScript and Cscript.exe) with the application already open, the behavior is the same and I can not access the property. The error dialog now shows the exact line in my custom script, that's why I think that the package is loaded.
If I use in the same instance my script from the Script Editor (no ActiveX) it runs.

The scripts are identical, except the "creation" of the application object.
I hope this more detailed explanation helps in the investigation.
Maybe there is something I need to define for my Property in the Model?

Best regards

Hi Andre,
it is hard to find problem without your package. I tried create my own and it is works. See steps below

  1. Create custom package, which has extension to package "Database Oracle 19 c" (better is set visibility too, but it is not necessary if we work just with Oracle19, becouse default visibility is all)

  2. Open Metamodel of this package and create class with this parameters

  3. Create property in this class

  4. Save Metamodel, Save package and close TDM.

  5. try this script from cmd

var App = new ActiveXObject("TDM.App");

//Wait until all TDM packages are loaded

//Model for which the report will be generated
var Model = App.OpenModelFromFile("D:\\OneDrive - TRANSCON Electronic systems, spol. s r.o\\Dokumenty\\Toad Data Modeler\\Standard Installation\\Models\\Oracle 19c.txp");
//Report destination folder
HTMLReport(Model, App.System, 'C:\\Temp\\' );

function HTMLReport(Model, System, OutputPath)
    var ReportRegistrar = System.CreateObject('ReportRegistrar');
    ReportRegistrar.DataSource = Model;
    var Report = ReportRegistrar.CreateReport('BasicHTMLPERReport'+Model.ModelDef.Abbrev, 1 , Model); //1 - HTML report
    Report.MyProperty = "test";
    Report.Path = OutputPath;
    Report.FileName = 'Report';    //Name of the HTML report file
    Report.Language = 'ENU'; //Abbreviation of language of dictionary used to translate terms in report (default is english - ENU)
    Report.Kind = 'HTML';
    Report.Layout = ReportRegistrar.GetLayoutClass(0); //Report Layout (0 - Frameless, 1 - Top Menu, 2 - Left Menu)
    Report.CSS = Report.Layout.CSSList.GetObject(0); //CSS style (Frameless 0-10, Top Menu 0-2, Left Menu 0-1)
    Report.GenerateInfo = false; //If true, adds information about model to the report

You can see I added to this script line when I access to my property
Report.MyProperty = "test";


I will create a small example here as well with the exact steps as above.
Are you also accessing the Property anywhere in your new Package? Just assigning works for me too

Thank your for your help!

I created a minimal example with your code and it worked.
I have extended your example and I got my own code to work.

And I think I found my mistake!
I thought I need to use the "Dispatch" type for more complex objects where I can assign something like:

Report.MyProperty = {
  configa: 'value',
  configb: true,
  configc: [
    'value1', 'value2'

Now I just use "String" in the MetaModel and it works.

I was a little bit to excited, that TDM executed without any error.
The execution works but my properties are all undefined.
I will come back to this post a soon as I figured that out.

Is there any limitation to the DataType Dispatch?
Or is it an issue, that I can not use in this case?

Best regards

I now have a final very hacky and bug sensitive solution:

  • I convert my Object to String
  • assign it to my Property
  • and convert it back to Object.

I am very unhappy with that solution, hopefully there is some "fix" or "feature" coming up in a future release.

ufortunatelly you can not assign some array or complex types to property of TDM object. Dispatch type is reserved for tdm objects not for jscript objects.


1 Like

Is this something planned for the future of TDM?
It is interesting, that this works in a running TDM instance but not if TDM starts from the Command Line.

I managed to do it the dirty way. It would be ideal to have a JSON parser or something like that. Maybe that’s something you could add in the future.

Maybe I will extend this to a custom framework but for now my dirty solution is enough :slight_smile:

Thanks for the support anyway :slight_smile: