Book a Demo

Author Topic: API access to TaggedValue datatypes in MDG  (Read 6309 times)

Jamo

  • EA Novice
  • *
  • Posts: 14
  • Karma: +0/-0
    • View Profile
API access to TaggedValue datatypes in MDG
« on: September 28, 2021, 07:55:48 pm »
Hi all,

I have two questions:
  • Why does EA allow typing of TaggedValues via MDGs if it only respects typing of enums
  • Is there a way to query MDG datatypes like enums via the API or via sql query?

According to documentation, TaggedValue.Value always returns a string. So even if I defined a TaggedValue type as an int, for example, the value is returned as string via API and also in the EA GUI, I can just type in whatever I want. The only somewhat exception is the enum type. In the GUI I can ONLY select pre-defined values (as intended) but with the API I can also add a not pre-defined value (which should be forbidden).
Here I'm wondering: Why even offer typing of TaggedValues if it is not respected anyway (except for enums)? Or is there a way to type constraint a tagged value that I'm just not seeing?

Regarding the second point: I have not found a straightforward way to query the datatype of a TaggedValue. As previously mentioned, I assume it's always string anyway, but for Enumerations it would be nice to get this information somehow. How I'm doing it currently is by checking if the content of the TaggedValue notes field matches the style of how EA stores literals (e.g. "Values: A,B,C,D Default: Select Value"). That's of course not a nice and clean way but the only practical way I found.

I also checked t_datatypes, but this does not store any MDG defined datatypes if I understand it correctly (at least I didn't find the MDG defined enumerations here).


Looking forward to your suggestions and insights!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: API access to TaggedValue datatypes in MDG
« Reply #1 on: September 28, 2021, 09:09:22 pm »
I'm afraid there is no easy solution. The only way to find information about the MDG is to actually read the MDG file.

Now that file could be stored somewhere on a shared drive, a website, the personal %appdata% or the model (as blob)

So the difficulty is checking all the possible locations to find the right MDG file contents.
When you have that it's a relatively straightforward parsing of the xml file.

Geert

Jamo

  • EA Novice
  • *
  • Posts: 14
  • Karma: +0/-0
    • View Profile
Re: API access to TaggedValue datatypes in MDG
« Reply #2 on: September 28, 2021, 10:43:39 pm »
Thanks, Geert!

Using external input (for example the MDG file) was also something I considered but I hoped that there was a different way.
But then I will follow that approach.