Book a Demo

Author Topic: API Attribute::StereotypeEx() behavior unexpected.  (Read 3438 times)

johnm9

  • EA User
  • **
  • Posts: 52
  • Karma: +0/-0
    • View Profile
API Attribute::StereotypeEx() behavior unexpected.
« on: November 28, 2008, 03:07:29 pm »
On Version 833.

I'm trying to change the stereotype of an Attribute from "Attribute" to "XSDAttribute" with the following VBA code:

  Set att = ele.Attributes.GetAt(i - 1)
               If att.StereotypeEx = "Attribute" Then
                   att.StereotypeEx = "XSDAttribute"
                   att.Update
  End If

However, the result is <<XSDAttribute, Attribute>>. It ends up that one more stereotype is added instead of changing it.

I've tried to use "att.Stereotype" instead of "att.StereotypeEX" but no luck.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: API Attribute::StereotypeEx() behavior unexpec
« Reply #1 on: November 28, 2008, 03:37:02 pm »
Hi John,

Based on the behaviour of EA's UI (Unique Interface) you'll have to delete the primary stereotype and then add the new one.  The multiple stereotypes management in EA is only barely serviceable.

You will also (if you plan to write defensive code), probably need to read in all the StereotypeEx And Stereotype, sort out what you want to retain and then kill both and set both in the right order (making sure that the first stereotype in StereotypeEx is the primary).

HTH,
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!