Book a Demo

Author Topic: Evaluate SQL result as a Package in Document template  (Read 6685 times)

Pawel Zubkiewicz

  • EA User
  • **
  • Posts: 78
  • Karma: +2/-1
    • View Profile
    • zubkiewicz.com
Evaluate SQL result as a Package in Document template
« on: March 10, 2016, 12:14:22 am »
Hi,

I'm wondering whether it is possible to find a Package via sql query and make EA recognize it as a Package in document template with all sections?

I have a fragment template and in custom query I've got this simple SQL for testing purpose:
Code: [Select]
SELECT t_package.ea_guid as CLASSGUID
from t_package
where t_package.ea_guid='{F3425580-C5F4-44f7-9F1D-0ED8F3CCB5D0}';

When I execute document generation of this fragment:
Code: [Select]
package >
{Pkg.Name}
diagram >
{Diagram.DiagramImg}
< diagram
child packages >
< child packages
< package
custom >
{CLASSGUID}
< custom

Only the part inside 'custom' tag is evaluated, the rest is ignored.

Is is possible to return via SQL a "full" Package so it will be evaluated with all its contents by the template?
Enhanced Requirement Attributes Addin for Enterprise Architect (ERA Addin) - http://zubkiewicz.com/?p=239

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Evaluate SQL result as a Package in Document template
« Reply #1 on: March 10, 2016, 12:16:54 am »
I always use a model document for things like that.

In model documents you can either drag a package on the model document, or use a search to specify the elements that need to be used.

Geert

Pawel Zubkiewicz

  • EA User
  • **
  • Posts: 78
  • Karma: +2/-1
    • View Profile
    • zubkiewicz.com
Re: Evaluate SQL result as a Package in Document template
« Reply #2 on: March 10, 2016, 12:31:45 am »
Yes, but they are less flexible even when ad-hoc generated as you presented in http://bellekens.com/2015/11/12/tutorial-generate-complex-documents-from-enterprise-architect-with-a-two-step-semi-automated-approach/

So, Geert, to your knowledge it's not possible to achieve that without model documents?
Enhanced Requirement Attributes Addin for Enterprise Architect (ERA Addin) - http://zubkiewicz.com/?p=239

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Evaluate SQL result as a Package in Document template
« Reply #3 on: March 10, 2016, 12:34:59 am »
No, I don't think so.

Geert

Pawel Zubkiewicz

  • EA User
  • **
  • Posts: 78
  • Karma: +2/-1
    • View Profile
    • zubkiewicz.com
Re: Evaluate SQL result as a Package in Document template
« Reply #4 on: March 10, 2016, 11:00:54 pm »
I managed to workaround this problem by using Document Script fragment which is available since EA 12.1.1224 - so pretty new feature.

Sparx says in changelog:
Quote
Document Script fragments now available:
- Allows specifying a script to be called by the generator that will return the fragment contents as RTF
- Set template type in Template Document Options
- Use with DocumentGenerator LoadDocument and GetDocumentAsRTF for dramatically increase documentation flexibility

They are quite convenient, but poorly documented. Anyway,  finally after years (no kidding!), I managed to generate documentation in nonlinear way without using virtual documents. I'm using it to include MockUp diagrams into UseCase specification. Each UseCase is traced to particular Package that contains mockups diagrams. Those Mockups can be stored anywhere in the model - finally, there is no need to store mockups in same tree branch as the use case :-)

This gives a lot of freedom and flexibility in the way repository can be structured, no need to worry about documentation generation. Of course, I use this for Mockups, but it can be used for anything.

I think I will write a blog post about this to explain it better :-)
Enhanced Requirement Attributes Addin for Enterprise Architect (ERA Addin) - http://zubkiewicz.com/?p=239

Pawel Zubkiewicz

  • EA User
  • **
  • Posts: 78
  • Karma: +2/-1
    • View Profile
    • zubkiewicz.com
Re: Evaluate SQL result as a Package in Document template
« Reply #5 on: April 25, 2016, 11:41:53 pm »
Here is my promised blog post about document generation that combines SQL and Document Script templates/fragments. Nonlinear generation of documentation in Sparx Enterprise Architect.
Enhanced Requirement Attributes Addin for Enterprise Architect (ERA Addin) - http://zubkiewicz.com/?p=239