Book a Demo

Author Topic: Documentation Template: conditional including  (Read 10636 times)

M Maher

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Documentation Template: conditional including
« on: September 18, 2015, 07:28:28 pm »
Hi,

Can anyone advise if its possible to have conditional (if/else) including of Fields based on whether they're empty?

In my specific example, I would like to do:

if {Connector.Name} is not empty:
   connector > {Connector.Name} < connector
else
   source > {Element.Name} < source

Any ideas?

Mat

Marc Lampron

  • EA User
  • **
  • Posts: 20
  • Karma: +0/-0
    • View Profile
Re: Documentation Template: conditional including
« Reply #1 on: September 19, 2015, 12:48:45 am »
I was looking for the same feature.
In generating a report, the conditional inclusion or exclusion of an element/diagram based on some generating time condition (isDefined, isEmpty, = value, …) could be very useful combined with the possibility (by example) to replace an undefined element with a specific text stating that the element is missing or undefined. That could be very valuable to facilitate the verification of model completeness and other means.

Pawel Zubkiewicz

  • EA User
  • **
  • Posts: 78
  • Karma: +2/-1
    • View Profile
    • zubkiewicz.com
Re: Documentation Template: conditional including
« Reply #2 on: September 22, 2015, 07:47:18 pm »
I'm also interested in such solution.

Has anyone manged to include template fragment conditionally? Or "implement" if statement inside the template?
Enhanced Requirement Attributes Addin for Enterprise Architect (ERA Addin) - http://zubkiewicz.com/?p=239

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Documentation Template: conditional including
« Reply #3 on: September 23, 2015, 07:46:45 am »
There is no if/else. The closest is the capability to remove a section of text if a field is empty. You should be able to find that information in the help.
« Last Edit: September 23, 2015, 07:47:06 am by simonm »

skiwi

  • EA Expert
  • ****
  • Posts: 2081
  • Karma: +46/-82
    • View Profile
Re: Documentation Template: conditional including
« Reply #4 on: September 24, 2015, 09:24:33 am »
Quote
The closest is the capability to remove a section of text if a field is empty.
and this tends to leave extra newlines (whitespace) in the document
Orthogonality rules
Position and Team disestablished, thanks austerity.
Now itinerant.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Documentation Template: conditional including
« Reply #5 on: September 24, 2015, 02:08:31 pm »
Quote
and this tends to leave extra newlines (whitespace) in the document
Not if you put the closing bookmark on the next line.

skiwi

  • EA Expert
  • ****
  • Posts: 2081
  • Karma: +46/-82
    • View Profile
Re: Documentation Template: conditional including
« Reply #6 on: September 24, 2015, 03:00:47 pm »
Quote
Not if you put the closing bookmark on the next line.
Yes, you did suggest this to me previously, thanks.
I tried to do this without success, and apart from looking like a kludge that should be fixed in the document generator, it didn't work for me,
could you please point me to an illustrated instruction in the user manual?
Orthogonality rules
Position and Team disestablished, thanks austerity.
Now itinerant.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Documentation Template: conditional including
« Reply #7 on: September 24, 2015, 03:39:48 pm »
I don't know what examples are in the help. I know that the default templates use the technique extensively.

I don't think it's a kludge. It's removing any characters between the two bookmarks. If the end bookmark is on the same line as the first that means it keeps the end of line/paragraph character, resulting in a blank line. It does get a bit tricky when consecutive paragraphs with different styles are being removed. The issue there is that the paragraph style is set on that newline character. The result can be unintuitive, even though it's unavoidable.