Author Topic: Printing information from different lanes on a diagram to different sections in  (Read 1326 times)

erobinson

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
I have a diagram which contains 4 lanes (vertical partitions). Each of these can contain one or multiple elements, and all the elements have notes behind them. The aim is to have 4 different sections in the document, each section should contain information from one of the lanes:
•   Name of the lane
•   Name of the element
•   Notes behind the element

If I use the ‘standard’ functionality provided in the document generator, i.e. don’t write custom SQL fragments, the following extract will print everything after the diagram image, but I cannot move it to different sections and you are dependent on the order EA loops through the elements. Please correct me if I’m wrong here….

diagram >
{Diagram.DiagramImg}
< diagram
element >
{Element.Notes}

child elements >
< child elements
< element
< package

I’ve tried removing the element >  tag and writing custom SQL (using fragments) to retrieve the information. This works up to a point, but then I get stuck with the notes coming back ‘unformatted’. Also, when the script returns multiple elements, I don’t know how to get the information in the ‘Element Name’ with ‘Element Notes’ underneath it format. (I’m not that up to date with writing complex SQL queries.)

Has anyone tried something similar before?

Esmeralda

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 11849
  • Karma: +460/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
There is a little trick you can apply to get formatted notes in SQL fragments.
See https://www.sparxsystems.com/enterprise_architect_user_guide/15.0/model_publishing/custom_sql_fragments.html (look for "formatted")

IIRC for .eap(x) repositories you have to change the "." into a "-" in the query (not in the template). For some reason they don't mention that anymore in the manual.

Geert

erobinson

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Thank you Geert, that was really helpful! For some reason didn't find that bit of information when I was searching through the documentation.

However, I've tried various permutations now, but I still don't get formatted notes.

This is my query:
select t_object.Name as FMP5_ElementNames, t_object.Note as [Notes.Formatted]
from t_object
WHERE Object_Type = 'Object' and Object_ID in (select Object_ID from t_diagramobjects where Diagram_ID = #DIAGRAMID#) and PDATA5 = '1st Line Support'

And this is in my template:
custom >
{FMP5_ElementNames}

{Notes.Formatted}
< custom

I've also tried the .Formatted outside the curly brackets in my template.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 11849
  • Karma: +460/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Which repository are you using?

For SQL Server this works:
query:
Code: [Select]
select o.Note AS [Description-Formatted] from t_object o
Template
custom>
{Description.Formatted}
<custom


Geert

erobinson

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
That worked like a charm! Thank you so much for your help Geert!  ;D