Book a Demo

Author Topic: Hide title with document fragments with no results (custom section)  (Read 4102 times)

Arnout Symoens

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Hi everyone,

I've taken my first steps in the Document generation with EA(v13), but I'm still struggling with styling document fragments. ;D

Problem :
- I've got  a document in which I reference a document template fragment.
- In this template fragment I'm using the custom tag, getting diagram names where the element is used in using SQL :
Code: [Select]
select Name from  t_diagram where Diagram_ID in
(select Diagram_ID from  t_diagramobjects where object_id=#OBJECTID#)
and t_diagram.Diagram_Type like 'Analysis'
order by Name
- In the template fragment template I have :
Code: [Select]
custom >
{Name}
< custom

Required:
I want to show the fragment result in the document, with a title above saying 'Diagrams'.
But I don't want to show the title if no results were returned.

I can't put the Title in the template fragment, as only text/layout is taken into account within the custom tag, but this would repeat the title for each result..
I can put the title in the main document template, before the TemplateFragment tag, but this shows the title, even if no results were found in the fragment, which gives a kind of sloppy document.

I walked through different documentations, but could not solve this.

Anyone who can shed some light on this ?

Thanks

Arnout

Arshad

  • EA User
  • **
  • Posts: 291
  • Karma: +21/-1
    • View Profile
Re: Hide title with document fragments with no results (custom section)
« Reply #1 on: February 23, 2018, 11:31:14 pm »
Hi Arnout

You need to get the result count first and based on the count you need to add the heading and diagrams.
Instead of Custom SQL in Template Fragment Type if you chose Document Script then its possible.
You just need to the run the query in script and based on the result you need to insert the headings.


Arshad

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Hide title with document fragments with no results (custom section)
« Reply #2 on: February 24, 2018, 01:07:36 am »
Arnout,

Simply add the title above the custom tag:
Code: [Select]
Diagrams
custom >
{Name}
< custom

If your query doesn't return anything the title won't show up either.

Geert