Book a Demo

Author Topic: Document generation - script fragment  (Read 2832 times)

Burrito

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Document generation - script fragment
« on: September 09, 2015, 05:59:55 pm »
Hi!

I'm using EA 12.

I can't reproduce the fragment scripting in the Learning Center's Reporting/RTF Fragments section.
- Create a Script Fragment 1 is OK
- Create a Script Fragment 2 is OK
- Add Script Fragment to template: I have no {model document: master template} to copy content from to my new template, but I guess this is not a big problem, I simply insert the template fragment into the package section. But I get only empty result strings on author, date, etc. on any PAckage Browser's package.


I have another question:

In the Learning Center an xml object is created in the script, whose fields can be used inside the template fragment. That's ok (however I was not able to try it), but is this the only way to do this?
For example I have a simple script called MyFunction, which returns a string. I insert the call 'MyFunction();' in the 'Document Options/Custom Query' field, I set it in drop-down menu and then what should I write in the fragment template's custom section?
Code: [Select]
custom>
???
<custom
Is it possible to script this way?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Document generation - script fragment
« Reply #1 on: September 09, 2015, 06:12:12 pm »
Your script should return the xml structure. Within that structure you can define different "columns" which you can then use in the template.
Look at the example script. DateGen is one of "columns" defined in the xml structure in the script.

The best way to go about this is to first test your script outside of the template by simply calling the function MyRTFData with an actual object ID from the script itself and printing the output to the output window or a messagebox.
If you are happy with that result then you can try to call the script from the template.

Geert

Burrito

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Document generation - script fragment
« Reply #2 on: September 09, 2015, 10:50:37 pm »
Thanks for the quick reply.

I managed to make the example script work, the problem was with the MSXML version. I modified MyRtfData as well, but the generation time increased quite much unfortunately (the script runs for every element).
« Last Edit: September 10, 2015, 12:17:38 am by 777555 »