Book a Demo

Author Topic: Creating a Diagram Reference via automation interf  (Read 4041 times)

DanielKeys

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Creating a Diagram Reference via automation interf
« on: January 17, 2012, 04:40:54 pm »
Hi everyone,

I was wondering if anyone knows of a way to create a Diagram Reference on a diagram via the automation interface (not via direct SQL update of the database).  

When I create a Diagram Reference in the UI by dragging an existing class diagram onto another class diagram I get the "Select Type" dialogue and select "Diagram Reference".  This creates an object of type UMLDiagram and adds the Diagram ID to the PDATA column in the object.  

There is nothing in the help on how to create these types and when I search the forum I only find people doing it directly via the database (which is cheating BTW).

Any suggestions?  

Thanks

Daniel

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Creating a Diagram Reference via automation in
« Reply #1 on: January 17, 2012, 05:06:02 pm »
Daniel,

If you found solutions using the database then that probably means there are no alternatives.
This is often the case when programming against the EA API. Cheating sort of becomes the standard :/

Geert

DanielKeys

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: Creating a Diagram Reference via automation in
« Reply #2 on: January 18, 2012, 08:14:59 am »
Thanks for the reply Geert.   I thought that would be the case but was hoping a solution using the interface was hiding somewhere.

Cheers

Daniel

pca

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Creating a Diagram Reference via automation in
« Reply #3 on: January 24, 2012, 01:46:06 am »
I also need to create diagram references via automation.  

Could the MiscData property of the Element class provide a solution ?  the documentation says that MiscData(0) corresponds to PData1 and MiscData(1) corresponds to PData2.  Which one should be used to store the diagram ID ?


pca

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Creating a Diagram Reference via automation in
« Reply #4 on: January 24, 2012, 02:21:22 am »
I just tried updating MiscData(0), but it is a read-only property...  :(
Could you share the SQL statement that you use to create the reference ?

philippeback

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Creating a Diagram Reference via automation in
« Reply #5 on: January 25, 2012, 11:06:00 pm »
UPDATE T_OBJECT SET PDATA1='<value>' WHERE ea_guid=<guidOfObject>

or

UPDATE T_OBJECT SET PDATA1='<value>' WHERE Object_ID=<objectId>

As of value, I'd create an object, check its guid, look at the values using Access and then set them accordingly.