Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: adoo on July 17, 2012, 12:08:52 am
-
hi everybody!
so I'm working with the document template to choose particular Glossary Type and i get the idea to make a SQL request on the Model search to select want i want to choose. know i don't know how to use it in the template design.
Best regards
-
Could you provide a bit more detail?
I mean, it seems to me that you want to use DocumentGenerator.DocumentModelGlossary for each term that your SQL search returns.
Is that not working?
regards,
Paulus
-
hi !
it's exactly what I'm trying to do.
i write a script to save the search result into a file. i just deliberate now if it's possible to call a define Template on the script. when yes! on which method in EA should i catch that?
thanks
-
OK paste the snippet below as a new EA script and run it, it will generate a file 'c:\xxx' where each each term in your glossary will be rendered using the RTF template 'gloss'.
The template 'gloss' could look e.g. like
model >
glossary >
{ModelGlossary.Term}: {ModelGlossary.Meaning}
< glossary
< model
Hope this helps!
regards,
Paulus
PS: Note that you can query the Terms collection iso using a SQL search.
option explicit
!INC Local Scripts.EAConstants-VBScript
'
' Populate the glossary with terms rior to running this script
' and make sure that template 'gloss' exists, displaying glossary terms
'
sub main
Dim gen as EA.DocumentGenerator
set gen = Repository.CreateDocumentGenerator()
gen.NewDocument("")
gen.InsertText "List of glossary items:",""
' session.output(Repository.Terms.Count)
dim i
for i=0 to Repository.Terms.Count-1
' session.output(Repository.Terms.getat(i).Term)
Dim term as EA.Term
Set term = Repository.Terms.GetAt(i)
gen.DocumentModelGlossary term.TermID,0,"gloss"
next
gen.SaveDocument "c:\xxx.rtf",0
end sub
main
-
thanks it's was very helpful
Regards
-
hi !
is it possible to create a document template on the Structure Document template -> System.?
when i create a template, it's always automatically save on the Document->Model.
regards!
-
Not sure: do you mean you want to use the template to generate an RTF containing information from all the models in a project file?
-
yes! i really want to generate information from template model in RTF document but it isn't work!
i think i could create a design template in the Document Template system.!
:-[