Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: stevesavage on November 02, 2016, 04:05:11 am
-
I know this has been around since 12.1, but I'm finally getting around to experimenting with this now, and it's showing a lot of promise of making more complex documents.
Has anyone else been experimenting with this?
Under Document Options -> Custom Query you can select Document Script, then select the script from your script library with the function you want to call (or select a script in the language you want to use, then write the function in the provided area)
E.g. I selected: "EAConstants-JScript"
Then defined my function in the provided area:
function createRTF(inElementID)
{
var local = {};
local.selectSQL = "SELECT t_object.Object_ID FROM t_object .....";
local.selectedElements = Repository.getElementSet(local.selectSQL,2); // could also use Repository.SQLQuery and then pull from the XML
local.documentGenerator = Repository.CreateDocumentGenerator();
local.documentGenerator.NewDocument("");
for ( local.i = 0 ; local.i < local.selectedElements.count ; local.i++ )
{
local.element = local.selectedElements.GetAt(local.i);
local.template = "VD-DMD-03-Data Dictionary (EN) Select-" + local.element.Stereotype;
Session.Output(local.element.Name);
local.documentGenerator.DocumentElement(local.element.ElementID,1,local.template);
}
return local.documentGenerator.GetDocumentAsRTF();
}
createRTF(#OBJECTID#);
Anyway, just playing with it now, will write a blog entry when I have more time.
Steve.
-
Hi,
I know this topic is old but I would love to hear about examples of this (more complex documents using DocumentGenerator). Document generation from creating regular custom templates in EA seems laborious. Did you ever write that blog post?
-
Have you read my article about document generation: https://bellekens.com/2015/11/12/tutorial-generate-complex-documents-from-enterprise-architect-with-a-two-step-semi-automated-approach/ (https://bellekens.com/2015/11/12/tutorial-generate-complex-documents-from-enterprise-architect-with-a-two-step-semi-automated-approach/)
I've tackled a lot of complex document generation requirements using this technique.
Geert
-
Thank you so much, Geert :)