Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: adoo on July 17, 2012, 12:08:52 am

Title: model search term with Document template connect
Post 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
Title: Re: model search term with Document template conne
Post by: Paulus on July 18, 2012, 04:06:21 am
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
Title: Re: model search term with Document template conne
Post by: adoo on July 19, 2012, 12:39:25 am
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
Title: Re: model search term with Document template conne
Post by: Paulus on July 19, 2012, 01:58:40 am
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.

Quote
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
Title: Re: model search term with Document template conne
Post by: adoo on July 19, 2012, 04:13:25 pm
thanks it's was very helpful
Regards
Title: Re: model search term with Document template conne
Post by: adoo on July 24, 2012, 12:10:04 am

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!
Title: Re: model search term with Document template conne
Post by: Paulus on July 24, 2012, 01:44:36 am
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?
Title: Re: model search term with Document template conne
Post by: adoo on July 24, 2012, 03:52:13 pm
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.!
 :-[