Book a Demo

Author Topic: VBS Element.Stereotype updateing confusion  (Read 5734 times)

tmz

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
VBS Element.Stereotype updateing confusion
« on: September 09, 2009, 05:38:21 pm »
Hi,
I am writing VBS script in Excel, that exports the Elements to EA (updates existing Elements in EA to the state described in Excel, doesn't create new Elements).
I have it working for TaggedValues, so after exporting I can see the changes in TaggedValues for given Element in EA immediately. The problem is, that I would like to change Element's Stereotype too. So I wrote:
Code: [Select]
myElement.Stereotype = "application"
myElement.Update

After that I don't see any change in Elements properties in EA, BUT the change has been somewhere written, because when I run the script again and read current Stereotype of the Element (before changing), it is set to "application". But in the same time EA shows different stereotype...

Any ideas?

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: VBS Element.Stereotype updateing confusion
« Reply #1 on: September 09, 2009, 11:06:12 pm »
If you mean that you don't see the change reflected in an open diagram, that is because you have not refreshed (or reloaded) the diagram.

Look at the various methods with names containing Reload and Refresh. Check both the Repository and Project classes.

[edit]For a better approach see Geert's post below, and the results a little further down.[/edit]
« Last Edit: September 10, 2009, 08:34:02 pm by Midnight »
No, you can't have it!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: VBS Element.Stereotype updateing confusion
« Reply #2 on: September 10, 2009, 04:09:34 pm »
Another one that I discouvered recently is the Repository.AdviseElementChange and AdviseConnectorChange.
Those work pretty good in refreshing the GUI of EA when something has changed.

Geert

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: VBS Element.Stereotype updateing confusion
« Reply #3 on: September 10, 2009, 04:26:54 pm »
Quote
Another one that I discouvered recently is the Repository.AdviseElementChange and AdviseConnectorChange.
Those work pretty good in refreshing the GUI of EA when something has changed.

Geert
I presume that's across all open diagrams?

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

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: VBS Element.Stereotype updateing confusion
« Reply #4 on: September 10, 2009, 05:23:09 pm »
I'm not sure about diagrams.
I used it after updating the notes of an element.
Before I used the AdviseElementChanged the seperate notes view would not get updated when I did an element.Update().
At first I tried the Element.Refresh, but that changes the selected element in the project browser as a side effect.
AdviseElementChanged does exactly what I wanted it to do without messing with the selected item in the project browser.

Geert

tmz

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: VBS Element.Stereotype updateing confusion
« Reply #5 on: September 10, 2009, 07:20:59 pm »
Big thanks, the tip with advice...() function was the right one:)