Book a Demo

Author Topic: Report generator inserting &lt instead of <  (Read 5619 times)

Richard Burke

  • EA User
  • **
  • Posts: 32
  • Karma: +1/-0
    • View Profile
    • Protean Electric
Report generator inserting &lt instead of <
« on: May 14, 2016, 02:29:14 am »
Hello,
We are using SQL (MYSQL) to generate data using a custom query for a report. Is there something we can do to stop the report generator from substituting &lt in place of the "<" symbol? The same applies to ">" and "&". The report also contains the glossary but characters are correctly displayed here.

Thanks,
Richard
Richard Burke
Software and Systems Manager
Protean Electric Limited

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Report generator inserting &lt instead of <
« Reply #1 on: May 14, 2016, 04:21:43 am »
The easiest thing would be to use the build in document generation in Enterprise Architect.
EA uses a type of markup language for the notes in order to allow for some formatting; you'll notice that when someone puts a part in bold or italic or something like that. The build in document generator knows about that markup and translates that into formatted text.

But if that is not an option for some reason you could use the API to translate the text for you.
Use EA.Repository.GetFormatFromField and EA.Repository.GetFieldFromFormat in order to convert between the different formats.
See http://www.sparxsystems.com/enterprise_architect_user_guide/12.1/automation_and_scripting/repository3.html for more information.

Geert

Richard Burke

  • EA User
  • **
  • Posts: 32
  • Karma: +1/-0
    • View Profile
    • Protean Electric
Re: Report generator inserting &lt instead of <
« Reply #2 on: May 16, 2016, 07:32:06 pm »
Thanks for the response Geert. We are using the document generator but the data is being generated by a SQL query using a Custom section.The document generator doesn't seem to be translating the text from the Note field correctly. I don't see how I could integrate the API function into this.

Maybe your talk on Advanced Documentation tomorrow in London will cover this  :).
Richard Burke
Software and Systems Manager
Protean Electric Limited

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Report generator inserting &lt instead of <
« Reply #3 on: May 16, 2016, 08:28:39 pm »
Ah, I see.

There was recently a feature added to allow for rich text in SQL fragments. I played with it a little bit, but never got it working myself.
Others have reported that it worked, so it must have been something I did wrong.

See the help here: http://sparxsystems.com/enterprise_architect_user_guide/12.1/report_generation/custom_sql_fragments.html

Quote
    custom >
     {Name}
     <fieldname>-Formatted     (for .eap (JET) repositories, or <fieldname>.Formatted for other types of repository)
     < custom

Geert

Richard Burke

  • EA User
  • **
  • Posts: 32
  • Karma: +1/-0
    • View Profile
    • Protean Electric
Re: Report generator inserting &lt instead of <
« Reply #4 on: May 17, 2016, 03:12:40 am »
Thanks Geert, I'll give that a try but not tomorrow because I'll be at the EA user group conference in London.
Richard Burke
Software and Systems Manager
Protean Electric Limited

Richard Burke

  • EA User
  • **
  • Posts: 32
  • Karma: +1/-0
    • View Profile
    • Protean Electric
Re: Report generator inserting &lt instead of <
« Reply #5 on: May 20, 2016, 02:30:29 am »
Hi Geert,

It works! The instructions on the link you provided are a little confusing so here's how I did it:

In the (MySQL) SQL query, I used to have the line:
Code: [Select]
Select objRequirement.Note As ReqText
I now have the line:
Code: [Select]
Select objRequirement.Note As "ReqText.Formatted"
When I added the field to the table in the report, I used to have:
Code: [Select]
{ReqText}
I now have the field:
Code: [Select]
{ReqText.Formatted}
The article you referenced says {Name}<fieldname>.Formatted which I don't think explains it well.

Anyway thanks to your help, notes fields can now be displayed with the formatting that appears in the Notes box.

Thanks,
Richard

P.S. It was good to meet you at last at the EA User Group Conference!


Richard Burke
Software and Systems Manager
Protean Electric Limited

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Report generator inserting &lt instead of <
« Reply #6 on: May 20, 2016, 04:27:32 am »
Ah, great, this explains it a lot better than the help did.
I'm sure next time I'll need it I will be able to make it work.

Yes, it was a great EAUG in Londen. Always nice to meet your digital aquintances in real life  :)

Geert