Book a Demo

Author Topic: Template for a RTF report of an activity diagram with linked requirements (EA10)  (Read 14684 times)

Marc Vanstraelen

  • EA User
  • **
  • Posts: 40
  • Karma: +6/-0
    • View Profile
We specify our use cases using activity diagrams. We also have standard RTF templates to generate a report on a use case containing the diagram(s) and all relevant elements in them. This works fine as each use case is stored in its own package with its activity diagram and the contained elements.

We also link business rules (documented using Requirement elements) to some of the activities in the activity diagram via <<trace>> links. These rules/requirements are stored in their own separate package.

I've now been asked to create a template that also includes these linked requirements, preferably in its own section. If I check the option "Include all diagram elements in report", this will show the requirements, but together with the other elements of the diagram.

Is there a way to have a report where the requirements do NOT appear between the other elements, but in their own section? The idea is to be able to use it on any package that contains a use case specification. I've been looking at template fragments, but did not yet manage to achieve the desired result.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Hey Marc,

If you use virtual documents you could link a model document to an SQL search that returns the necessary requirements.
If not you could create an SQL Template fragment that lists all of them for a certain package or element.

Geert

Marc Vanstraelen

  • EA User
  • **
  • Posts: 40
  • Karma: +6/-0
    • View Profile
I've built an SQL query to retrieve all linked requirements from the activities in the package. When I test this in the Query Builder of the Project Search, the query returns the expected elements.

I then created a template fragment where I copied this query in the "Custom SQL" tab of the document properties. When I start the generation of the document with a template that uses this fragment, I get an error "ORA-00911: Invalid Character" (our repository is in Oracle).

I suspect the "invalid character" is due to the fact that the query contains a #Branch# macro to limit the results to the selected package and its subpackages. Interestingly, when I wrote and tested the SQL statement in the Project Search, I also got the same error message when I used the SQL tab instead of the "Search Builder" tab. So it looks as if the #Branch# macro is not expanded.

Is there a way around this? If not, I guess I'll have to use virtual documents instead...

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
I think you are limited to #PackageID# and #ObjectID#

But if you know he maximum depth of the packages you can join as many t_package tables as you need.
(or you might even try one of those fancy recursive queries, but I've never used those in Oracle)

Geert

philchudley

  • EA User
  • **
  • Posts: 750
  • Karma: +22/-0
  • EA Consultant / Trainer - Sparx Europe
    • View Profile
Yes Geert is correct, in a SQL fragment you are limited to #PackageID# and #ObjectID#

Support for #Branch# would be useful though

Cheers

Phil
Models are great!
Correct models are even greater!

Marc Vanstraelen

  • EA User
  • **
  • Posts: 40
  • Karma: +6/-0
    • View Profile
I replaced the part of the where clause "Package_ID in (#Branch#)" with "Package_ID = #Package#".
This again works in the Search Builder tab of the Project Search, but still gives the same error in the SQL tab or when used in the template fragment...

Do you think that I could make it work with virtual documents using a predefined search? I've never worked with virtual documents yet, so I guess the best way to find out is to try it...

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Marc,

It's #PackageID# you need to use in template fragments.
You can also use #ObjectID# and #DiagramID# depending on where you use the fragment.

See http://www.sparxsystems.com/enterprise_architect_user_guide/12.1/report_generation/custom_sql_fragments.html

Geert

Marc Vanstraelen

  • EA User
  • **
  • Posts: 40
  • Karma: +6/-0
    • View Profile
Geert,

The version 10 documentation mentions #Package#, which is also what works in the Search Builder... I tried #PackageID# but got the same message (and this doesn't work in the Search Builder...)

http://www.sparxsystems.com/enterprise_architect_user_guide/10/navigate_search_and_trace/creating_filters.html

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Ah, could be. I never did RTF document generation in v10.

Maybe it's time for an upgrade?

Geert


Marc Vanstraelen

  • EA User
  • **
  • Posts: 40
  • Karma: +6/-0
    • View Profile
Navigating the EA documentation is never easy  :(
I looked a bit more and found this:
http://www.sparxsystems.com/enterprise_architect_user_guide/10/reporting/custom_query_fragments.html

So apparently it should be #PACKAGEID# in an RTF fragment, whereas it's #Package# in the Query Builder. Just to keep things nice and simple  ;)

Not sure what I'm doing wrong then... Is this case sensitive?
I'll try some more...

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
If you can't figure it out I'll swing by on Monday in my lunch break if you want. I'm sure it's some small detail..

Geert

Marc Vanstraelen

  • EA User
  • **
  • Posts: 40
  • Karma: +6/-0
    • View Profile
Well it seems to be case sensitive after all... I replaced #PäckageID" with #PACKAGEID# and lo and behold, the query works!

Now I still need to figure out how I can make the fragment display the notes of the requirements as formatted text rather than plain text full of tags like

Quote
<font color="#ff0000"><u>SEY 29/02/2015: QC 3890:   </u></font>
<ul>
   <li><font color="#ff0000"><b>Si   type de la pièce =  NOT02 =&gt;</b> </font></li>
</ul>

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
I don't think you can do that in v10 in SQL fragments.
In v12(.1) they have invented something that should allow you to have rich text, but I never got that working.

I did manage to get it working in Script Fragments (are those available in v10 already?)

Otherwise you'll have to go back to the virtual document solution.

Geert

Marc Vanstraelen

  • EA User
  • **
  • Posts: 40
  • Karma: +6/-0
    • View Profile
Exploring the virtual documents alternative.

I have a query that returns all linked requirements based on the activities in a package. This query returns the ea_guid as CLASSGUID, Object_Type as CLASSTYPE.
From the resulting selection, I can successfully generate a document using an existing template.

Now, when I define a Model Document to which I associate this search and this template, and then ask to generate the document while the desired package is highlighted in the project browser, I get an error message "Document generation failed".

This query again contains the #Branch# macro, but I tried using #Package# and #PACKAGEID# and got the same error.
How do I get a model document based on a search to work for a specific package?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Marc,

In that case you have to use the '<Search Term>' in the search and fill it in with for example the package GUID
(you can copy the GUID from the context menu Copy/Paste|Copy Node GUID to Clipboard)

I do something similar for business rules linked to a use case.
The code below is an SQL Search. In the tagged values of the model document I select this search and fill in the GUID of the use case.

Code: [Select]
select rl.ea_guid AS CLASSGUID,rl.object_type AS CLASSTYPE,rl.name AS Name, rl.stereotype AS Stereotype
,package.name AS PackageName ,package_p1.name AS PackageLevel1,package_p2.name AS PackageLevel2,package_p3.name AS PackageLevel3
from ((((((t_object uc
inner join t_connector c on c.[Start_Object_ID] = uc.[Object_ID])
inner join t_object rl on rl.[Object_ID] = c.[End_Object_ID])
inner join t_package  package on rl.package_id = package.package_id)
left join t_package  package_p1 on package_p1.package_id = package.parent_id)
left join t_package  package_p2 on package_p2.package_id = package_p1.parent_id)
left join t_package  package_p3 on package_p3.package_id = package_p2.parent_id)
where uc.ea_guid = '<Search Term>'
and rl.[Object_Type] = 'Activity'
and rl.[Stereotype] = 'Business Rule'

Geert