Author Topic: How to get the value of "Static" property of an attribute in templates  (Read 6309 times)

fp123

  • EA User
  • **
  • Posts: 28
  • Karma: +0/-0
    • View Profile
Hi,

I am trying to get the value of the property "Static" of an attribute into a document generated with a template in ea. The attribute object belongs to a class in the project browser.
In the template I have inserted the following table:


In the project browser there are three attributes, two have the static property set to true one has it set to false.



In the generated documents all attribute objects are shown as static.


As you can see in the first image, I have used the fields "{Att.Static}" and "{Att.IsStatic}". But the value of both fields is always "true" or "static" for all of the three attributes.
How can I get the value of that property into my generated document?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13288
  • Karma: +557/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How to get the value of "Static" property of an attribute in templates
« Reply #1 on: September 02, 2021, 09:02:15 pm »
Seems like a bug indeed. You better report it to Sparx.

In the mean time you can work around it by creating an SQL fragment for your attributes table.

Geert

fp123

  • EA User
  • **
  • Posts: 28
  • Karma: +0/-0
    • View Profile
Re: How to get the value of "Static" property of an attribute in templates
« Reply #2 on: September 02, 2021, 10:02:44 pm »
Thank you for verifying, Geert. I've sent a bug report to sparx. Hope they will read it, i've got no support license at the moment.

Working around the problem with sql will be the next step. Do you know, in which table theses values are stored? Could not find it in the database schema:
https://blog.sparxsystems.de/wp-content/dbSchemaV15-1.png

Edit: The Schema-image seems to be wrong, the property "IsStatic" can be found directly in t_attribute. But "Static" is also missing in the database.
« Last Edit: September 02, 2021, 10:09:28 pm by fp123 »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13288
  • Karma: +557/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How to get the value of "Static" property of an attribute in templates
« Reply #3 on: September 02, 2021, 10:32:42 pm »
Code: [Select]
select a.IsStatic from t_attribute a
Geert

fp123

  • EA User
  • **
  • Posts: 28
  • Karma: +0/-0
    • View Profile
Re: How to get the value of "Static" property of an attribute in templates
« Reply #4 on: September 07, 2021, 05:30:00 pm »
Ok, I have created an SQL query to get the value an the text I want to display in the generated document:

SELECT IF(attribut.IsStatic = 1, 'Static', 'Not static') AS statisch
FROM t_attribute attribut
where attribut.Object_ID = #OBJECTID#;

I have put this in a new fragment as a custom section


And the fragment is now in the table of the template I use for generating my document. But now all fields are not active anymore and the text for the static property is shown mutiple times:

Template:


Generated document:


What am I doing wrong?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13288
  • Karma: +557/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How to get the value of "Static" property of an attribute in templates
« Reply #5 on: September 07, 2021, 05:41:02 pm »
You'll have to replace the whole attribute> section with a SQL fragment.
The fragment contains the whole table.

So you'll have to include the other properties such as Name and Type in your fragment as well.

Geert

fp123

  • EA User
  • **
  • Posts: 28
  • Karma: +0/-0
    • View Profile
Re: How to get the value of "Static" property of an attribute in templates
« Reply #6 on: September 07, 2021, 08:45:54 pm »
That was the solution. Thank you Geert!  :)

fp123

  • EA User
  • **
  • Posts: 28
  • Karma: +0/-0
    • View Profile
Re: How to get the value of "Static" property of an attribute in templates
« Reply #7 on: September 11, 2021, 12:21:20 am »
The never ending story continues.
Now I am trying to get the notes of the attributes into my document. The problem is, that in the notes formatting tags like <i> and <u> are used. When I get the notes from my sql query, EA does not convert these tags and leaves them in the text.


My next idea was to put a normal field {Att.Notes} into the template under the fragment that I use to get the values via sql. But now EA does not get the notes but only displays the name of the field (and only once, not three times, because there are three attributes in my class) in my generated document.


Is it possible to solve that problem?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13288
  • Karma: +557/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: How to get the value of "Static" property of an attribute in templates
« Reply #8 on: September 11, 2021, 01:19:05 am »
Yes use as [Notes-Formatted] in your query and {Notes.Formatted} in your template

There are a number of threads in this forum that discuss that.

Geert

fp123

  • EA User
  • **
  • Posts: 28
  • Karma: +0/-0
    • View Profile
Re: How to get the value of "Static" property of an attribute in templates
« Reply #9 on: September 14, 2021, 10:52:21 pm »
And one more time thanks to you Geert!