Book a Demo

Author Topic: Documentation Fragment Template - separated list  (Read 5248 times)

Zdenek

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Documentation Fragment Template - separated list
« on: September 04, 2014, 02:04:02 am »
Hello,
I would like to create Fragment Template which inserts comma separated list of names of child elements filtered by stereotype.

I created Fragment Template based on following SQL query:
SELECT Name
FROM t_object
WHERE Stereotype = 'somestereotype' and ParentID = #OBJECTID#

and content is
[highlight]custom>[/highlight]
{Name}[highlight]<custom[/highlight]


it's working but...

I would like to get output in following form (problematic pieces of text is [highlight]highlighted[/highlight]):

[highlight]Label: [/highlight]Name1[highlight], [/highlight]Name2[highlight], [/highlight]Name3[highlight], [/highlight]...

And I don't know how to say in template engine language that "Label: " should be placed before first item (and if there is no items, there must be there no label) and ", " between two items.

Does anybody know how to change content of my Fragment Template to achieve required output?

Thanks,
Zdenek

danbosscher

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Documentation Fragment Template - separated li
« Reply #1 on: September 04, 2014, 05:56:42 am »
Try

Label: [highlight]custom>[/highlight]{Name}, [highlight]<custom[/highlight]

Anything within a section (such as custom) should be repeated for each item. If it is the name of a recognized field enclosed in brackets {}, it will be replaced the current value for that field, otherwise it is treated as a literal.

I don't know what happens if there are no items, but placing Label before the beginning of the section will keep it from being generated more than once.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Documentation Fragment Template - separated li
« Reply #2 on: September 04, 2014, 09:03:32 am »
You can do it by inserting bookmarks. (In my example below a bookmark called LIKETHIS would be shown as {LIKETHIS})

[highlight]custom>[/highlight]{CustomSQL_TITLE_Begin}Label: {CustomSQL_TITLE_End}{CustomSQL_LIST_Begin}, {CustomSQL_LIST_End}{Name}[highlight]<custom[/highlight]

Zdenek

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: Documentation Fragment Template - separated li
« Reply #3 on: September 04, 2014, 05:50:29 pm »
I am sorry, but I was not able to find how to correctly insert bookmarks into my template.

I found in context menu option Insert/Bookmark... with following items: CustomSQL_Begin, CustomSQL_Begin_Inner, CustomSQL_End, CustomSQL_End_Inner

But didn't found way how to insert it into text.

When I select one of bookmarks and click Insert button, dialog is closed but nothing else happens. I of course tried all other buttons and double click.

I tried to copy & paste bookmark name and put it into {} but then it was just placed to output document.

I am using EA version 11.1.1110

Thanks for your help :-)

Zdenek

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: Documentation Fragment Template - separated li
« Reply #4 on: September 04, 2014, 08:36:18 pm »
Ok, after deeper investigation and RTF source analyzing I understand how it works.

So, my problem is solved  :) although working with RTF bookmarks is not user friendly (or I am missing some option how to make them visible in EA editor).

Thanks for help

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Documentation Fragment Template - separated li
« Reply #5 on: September 05, 2014, 08:54:05 am »
You're right. It's not at all user friendly. Unfortunately there's a lot to be desired about the use of bookmarks, and so far I have been unable to push for improvements.

AndyJ

  • EA User
  • **
  • Posts: 337
  • Karma: +5/-3
  • It's only a model
    • View Profile
Re: Documentation Fragment Template - separated li
« Reply #6 on: September 05, 2014, 01:25:19 pm »
I made quite a bit of headway with the RTF editor, and then tried Ian Mitchell's tool.

I wonder if I can invoke him by uttering the magic word:

[size=16]eaDocX[/size]
Sun Tzu: "If you sit by the river long enough, eventually the body of MS Visio floats past."