Book a Demo

Author Topic: Changing the Stereotype of an Attribute by VBA  (Read 3614 times)

johnm9

  • EA User
  • **
  • Posts: 52
  • Karma: +0/-0
    • View Profile
Changing the Stereotype of an Attribute by VBA
« on: November 21, 2008, 10:38:21 pm »
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.

Please advice.  :-[

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Changing the Stereotype of an Attribute by VBA
« Reply #1 on: November 22, 2008, 05:53:20 am »
Try explicitly clearing the string, then updating, then setting the new value (and updating again of course).

If you are using the most recent build of EA (833 at this time) then you should report this as a bug to Sparx. Either the documentation or the product is incorrect. Use the Report a Bug link near the bottom of any forum page.

David
No, you can't have it!

johnm9

  • EA User
  • **
  • Posts: 52
  • Karma: +0/-0
    • View Profile
Re: Changing the Stereotype of an Attribute by VBA
« Reply #2 on: November 22, 2008, 01:14:16 pm »
You mean something like this, right? I had tried it. Same result.

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


I have also try this, it ends up as <<, Attribute>>.  :-/

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


«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Changing the Stereotype of an Attribute by VBA
« Reply #3 on: November 22, 2008, 10:47:26 pm »
That's exactly what I meant. The result you are getting certainly seems incorrect.

So on the the next part of my post. First ensure that you are testing against the most recent EA build (833). If the bug is present there, fire in that bug report immediately. You might make the cut for getting it resolved in the next build or two.

Timing is important here. The delay could be considerable if the issue does not get handled before the run-up to EA 7.5. Once that process begins there will probably be a waiting period of a few builds (which will be alpha tests, not released to the community). When the beta builds do come out there will be plenty of other things going on, so this issue could get further delayed.

NB: If we're really lucky this is simply a documentation issue. Still, the bug report could be the trigger for getting it resolved.

David
No, you can't have it!