Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Anna I on March 18, 2017, 01:12:09 am
-
I have created a Documentation Template for UML Class Diagrams and have inserted tagged values in my RTF:
{ElementTagVal.Name}:{ElementTagVal.Value}
However, a number of tags are defined in an MDG, and for each element only SOME tags will be populated with values.
Is it possible to include a condition that checks if a tag has a value and if it is null, then the tag is not printed?
Thanks
Anna
-
Hi Anna,
While trying to create my own hyperlinks I found that for this you could:
1. Create a fragment
2. Use a SQL fragment
3. Add the fields to the custom section
In the template:
1. Add the fragment template
When the query of the SQL fragment return no records, no output is generated.
Kind regards,
Robert
-
Many thanks, Robert! :D
Sounds like a solution which will solve the problem! :-)
Anna
-
It seems I require a bit more help ;-)
In the fragment document I now have:
custom >
{TAGName}:{TagVal}
< custom
I have created the beginning of a fragment with the following custom SQL query:
"SELECT TagValue as TagName, Notes as TagVal FROM t_taggedvalue WHERE Notes NOT LIKE '$ea_*'"
but how do I reference the current element and select just those tag/value pairs held by that element? (a join with what? using the #OBJECTID# tag in a where clause?)
Cheers,
Anna
-
You don't need an SQL query for that (by the way you are querying the wrong table) you can use .start and .end bookmarks in your template to hide section in case a certain field is not filled in.
There is some explanation in the help about that.
Geert
-
Thanks Geert!
Had actually already (unsuccessfully) attempted to apply bookmarks, but I will delve further into the documentation now :-)
Anna
-
Update:
Have now successfully 'hidden' most of my tags without values. For instance, the 'versionInfo' tag:
PkgElement.valueOf(versionInfo).Start{PkgElement.valueOf(versionInfo)}PkgElement.valueOf(versionInfo).End
- oh, and what a shame that the bookmarks aren't shown in the editor - very un-userfriendly ;-)
Have encountered two issues though:
1) If my tag contains a whitespace (ex. label (da)), I cannot created a bookmark for it (it simply won't let me insert it - is there an escape function/joker for whitespaces? - or is there a naming convention (eg. lowerCamelCase) for tag definitions? Haven't yet found it in the UML standard)
2) If my tag has memo as datatype, it's description in Notes will wrongly be used as the 'value field' and thus always be shown.
Instead continuing with the SQL fragment solution, I seem to be getting closer with:
SELECT Property, Value FROM t_objectproperties WHERE Object_ID = #OBJECTID# AND Value NOT NULL AND Value NOT LIKE '<*'