Book a Demo

Author Topic: Change Diagram Type to MDG defined one in Script  (Read 6260 times)

[email protected]

  • EA Novice
  • *
  • Posts: 15
  • Karma: +0/-0
    • View Profile
Change Diagram Type to MDG defined one in Script
« on: June 24, 2015, 09:26:03 am »
We have defined some new diagram types in an MDG profile and now want to change some existing diagrams to these types in a script.

The API has an attribute Diagram.MetaType but the help says this is read-only. Is there a way to update this (you can do it from the UI)?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Change Diagram Type to MDG defined one in Scri
« Reply #1 on: June 24, 2015, 06:42:06 pm »
MDG diagrams have an entry in t_diagram.styleEx which looks like this (for a white board diagram):
Code: [Select]
MDGDgm=Whiteboard::Whiteboard Diagram;HandDraw=1;Whiteboard=1;So most likely you just need to add
Code: [Select]
MDGDgm=<MDG>::<diagram name>;
q.
« Last Edit: June 24, 2015, 06:42:33 pm by qwerty »

[email protected]

  • EA Novice
  • *
  • Posts: 15
  • Karma: +0/-0
    • View Profile
Re: Change Diagram Type to MDG defined one in Scri
« Reply #2 on: June 24, 2015, 11:20:11 pm »
Seems logical - and in fact when we check diagrams which we have manual changed using the UI it's as you describe. However....

We can set the relevant part of the attribute, but when we call Diagram.Update() and then re-load the diagram, it's reverted back to it's previous value!

Anybody got any ideas why?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Change Diagram Type to MDG defined one in Scri
« Reply #3 on: June 24, 2015, 11:34:57 pm »
Have you cross-checked with
Code: [Select]
SELECT * FROM t_diagramwhether the changes were actually made?

q.

P.S. You need to close/open EA to see the changes. I changed a normal class diagram. The icon was not changed and the background ditto (those are other parameters). But the toolbox was that of the white board.
« Last Edit: June 24, 2015, 11:44:17 pm by qwerty »

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: Change Diagram Type to MDG defined one in Scri
« Reply #4 on: June 25, 2015, 04:25:05 pm »
Unfortunately you cannot change the "MDGDgm" value in Diagram.StyleEx via automation.  It was an intentional decision by our development team that it was not safe to change this value via automation once it's already been set.  The only way to change this value is either by using the "Change Type" command in the GUI, or change it via sql (usual caveats apply there).

[email protected]

  • EA Novice
  • *
  • Posts: 15
  • Karma: +0/-0
    • View Profile
Re: Change Diagram Type to MDG defined one in Scri
« Reply #5 on: June 25, 2015, 06:35:46 pm »
Thanks for the reply (and for the reply to my colleague Simons support request).

A bit annoying but not a big issue as we assume the only difference the diagram type makes is which toolbox is displayed by default?

« Last Edit: June 25, 2015, 06:37:34 pm by jtowers »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Change Diagram Type to MDG defined one in Scri
« Reply #6 on: June 25, 2015, 06:54:47 pm »
Yes. The toolbox is the main visible difference. I guess some MDG add-ins implement behavior depending on the diagram type.

q.