Book a Demo

Author Topic: DocumentGenerator API  (Read 5019 times)

Michel Gibelli

  • EA Novice
  • *
  • Posts: 14
  • Karma: +1/-0
    • View Profile
DocumentGenerator API
« on: April 23, 2016, 01:39:57 am »
Hello,

I am trying to use the DocumentGenerator class within VBscripts
http://www.sparxsystems.com/enterprise_architect_user_guide/12/automation_and_scripting/document_generator_interface_class.html

I have a template named myTemplate in a template group named myTemplateGroup
I have a call like :
documentGenerator.DocumentElement(elementID, 0, "myTemplate")

It works perfectly when I am in the same model file.

But when I deploy the script and the template in a MDG technology, I have the message "Invalid template supplied".
My template goes in a folder named myMDGTechnology and under a group named myTemplateGroup.

My question is : Should the argument templatename be prefixed with the MDG technology name and/or with the group name ?
Something like :
documentGenerator.DocumentElement(elementID, 0, "myMDGTechnology/myTemplateGroup/myTemplateName")

I have tried several combinations (slashes, colons) but I did not succeed.
Has someone more information about this syntax ?

Note : as a workaround, I override the template and its works again. But it is not very elegant for my end users  :(

Thanks in advance !
Michel


Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: DocumentGenerator API
« Reply #1 on: April 27, 2016, 12:47:42 am »
Hi Michel,


I've done exactly what you've done and got it to work. No prefixes, just the simple name of the template.

The group shouldn't matter because the groups don't survive MDG Technology deployment: they only exist in the project where you're maintaining the MDG Technology.

How are you deploying the MDG Technology? Are you importing it into the project, or just referencing the file in the Settings dialog? I use the latter approach, and it does work for me. On EA 11, admittedly.

Can you double-check that your template is indeed included in the MDG Technology, and that it's a proper template and not a fragment or something?


/Uffe
My theories are always correct, just apply them to the right reality.

Michel Gibelli

  • EA Novice
  • *
  • Posts: 14
  • Karma: +1/-0
    • View Profile
Re: DocumentGenerator API
« Reply #2 on: April 28, 2016, 08:06:16 pm »
Hi Uffe,

I deploy my MDG Technology just by referencing the file in the Settings dialog.
As you suggested, I have double-checked everything, and I found that my template was declared as a fragment !
This was the source of my problem.

And surprinsingly, it works when I am in the model where I maintain the MDG Technology, but not in a model where the technology is deployed.

Thank you very much !
Michel