Book a Demo

Author Topic: Documentation with sql and linked documents  (Read 3654 times)

JoelL

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Documentation with sql and linked documents
« on: December 05, 2019, 12:21:51 am »
Hello,

I am working with a template for my use cases. My template is fetching information from the selected use case and requirements with a certain stereotype that have a connection to said use case.
To get my requirements under desired header in the end document im using fragments with sql queries. My problem is that I cant find a way in which to include the information from linked document in my sql query.
Is this possible or am I going on about this all wrong?

Linked document works fine if I dont use sql but then I cant sort the information the way I would want.
Im using EA15 with a repository in a sql server database.

/Joel

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Documentation with sql and linked documents
« Reply #1 on: December 05, 2019, 12:35:23 am »
Hi Joel,

No, unfortunately you can't get linked document information into an SQL fragment.

The alternative is to use a Document Script fragment, and getting the linked document info that way.

Here is example code that can be used as script to be connected with a Document Script fragment

Code: [Select]
'[path=\Projects\Project A\Template fragments]
'[group=Template fragments]
option explicit

!INC Local Scripts.EAConstants-VBScript

'
' Script Name: LinkedDocument
' Author: Geert Bellekens
' Purpose: Gets the linked document for the given objectID and returns it as an RTF string.
' To be used in document generation as a Document Script.
'      Call as getLinkedDocument(#OBJECTID#)
' Date: 2018-04-25
'
function getLinkedDocument(objectID)
dim element as EA.Element
set element = Repository.GetElementByID(objectID)
getLinkedDocument = element.GetLinkedDocument
end function

'test
'Session.Output getLinkedDocument(435910)

Another approach is to use Virtual Documents, and create a model document for each of the linked requirements. (because then you can use a simple template and check the linked document checkbox)

I often write scripts to construct the virtual document based on these types of things, see also https://bellekens.com/2015/11/12/tutorial-generate-complex-documents-from-enterprise-architect-with-a-two-step-semi-automated-approach/

Geert

JoelL

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Documentation with sql and linked documents
« Reply #2 on: December 05, 2019, 02:33:32 am »
Thanks a bunch Geert for a fast and well put response!
I will try your document script suggestion.