Book a Demo

Author Topic: replace function in custom query not possible  (Read 3081 times)

HA.P

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
replace function in custom query not possible
« on: April 25, 2022, 11:00:29 pm »
Dear forum,
In my custom query i want to get the note text of the elements. In some cases there are german umlauts (ä, ö, ü), which are not displayed correctly.
I tried using the REPLACE()-function but it´s not possible because of the Microsoft Jet Engine.
I´m grateful for all help!

HA.P

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: replace function in custom query not possible
« Reply #1 on: April 25, 2022, 11:35:00 pm »
What are you using the query for?
If you want to use it in a document generation template, you have to make it "formatted".

Geert

HA.P

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: replace function in custom query not possible
« Reply #2 on: April 25, 2022, 11:42:54 pm »
Hi Geert,

yes, I want to generate a report using the query. What do you mean by "formatted"? Sorry because i´m just new to EA.

Modesto Vega

  • EA Practitioner
  • ***
  • Posts: 1183
  • Karma: +30/-8
    • View Profile
Re: replace function in custom query not possible
« Reply #3 on: April 25, 2022, 11:49:57 pm »
Gert this is the 2nd time you give the same response in the forum today. Encoding and formatting are 2 very different things. But I fully appreciated that in Sparkish "formatted" means encoding - i.e., by specifying that a field in "formatted" you are also telling Sparx the field is encoded.

HA.P when you create report template you call tell Sparx that field is formatted and it will render the contents of the field correctly.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: replace function in custom query not possible
« Reply #4 on: April 26, 2022, 12:04:27 am »
The notes in EA are "formatted" text.
This means that EA uses their own markup language to indicate things such a bold, italic, textcolor. But they also encode "special" characters using their unicode character value.

So if you want to be see the "real" value in your template, you need to tell EA the field contains formatted text.
See this page (look for "formatted") https://sparxsystems.com/enterprise_architect_user_guide/15.2/model_publishing/custom_sql_fragments.html

For SQL Server you do something like

Code: [Select]
select o.Note as [Notes-Formatted] from t_object o
In your template you use
{Notes.Formatted}

For other databases there might be differences in the SQL syntax.

Geert

HA.P

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: replace function in custom query not possible
« Reply #5 on: April 27, 2022, 05:47:35 pm »
Hi Geert and Modesto,

the text looks perfectly now. Thanks all for your help!