Author Topic: Document Generation issue with using & in the model  (Read 1945 times)

lynch80516

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Document Generation issue with using & in the model
« on: March 02, 2020, 03:49:39 am »
I have element names and notes that contain & in the description link in a Acronym like TT&C, R&D, etc. However, when crating a document through a template it comes out as TT&ampC, R &amp D, etc. Is there a way to "escape" the & so it comes out correctly?

Thanks,

John

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 12250
  • Karma: +484/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Document Generation issue with using & in the model
« Reply #1 on: March 02, 2020, 03:49:49 pm »
What kind of template did you use?

The regular template should translate these xml escaped characters. (in v15 or higher I think)
If you are using an SQL or script fragment you should indicate that it is a formatted field.

Geert

lynch80516

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: Document Generation issue with using & in the model
« Reply #2 on: March 02, 2020, 05:00:28 pm »
It is using a sql query via a fragment. I’m not familiar with a formatted field

John

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 12250
  • Karma: +484/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Document Generation issue with using & in the model
« Reply #3 on: March 02, 2020, 06:00:03 pm »
See the help here:
https://www.sparxsystems.com/enterprise_architect_user_guide/15.1/model_publishing/custom_sql_fragments.html
Quote
It is possible to force a field to be processed as a hyperlink or as formatted notes, by providing a column in this format:

    custom >

     {Name}

     <fieldname>.Formatted      (or <fieldname>.Hyperlink)       (for all repositories, excluding .eap)

     < custom

In your custom SQL Query statement, you must use an alias matching the template field name; for example (in MySQL):

     SELECT ea_guid AS CLASSGUID, Object_Type AS CLASSTYPE, Name, Note as "Note.Formatted" FROM t_object

     Where Object_ID=#OBJECTID#

For SQL Server I use
Code: [Select]
Note as [Note-Formatted]In my queries.

Geert