Book a Demo

Author Topic: Part through API  (Read 4145 times)

sravang

  • EA User
  • **
  • Posts: 33
  • Karma: +0/-0
    • View Profile
Part through API
« on: March 10, 2021, 01:02:07 am »
Hello,

I have gone through forum and found that we can add an part and make it refer to instance of other element by assigning the element ID to classifier id.

But through UI when I add part as mentioned in here - https://sparxsystems.com/enterprise_architect_user_guide/15.2/model_domains/creating_parts_and_ports.html
 I have the guid of instance element in PDATA1 column and ele.MISCDATA[0] through API.

How to set MISCDATA[0] value to GUID of instance element or else how to assign PDATA1 value ??

Thanks,
Sravan

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Part through API
« Reply #1 on: March 10, 2021, 04:30:49 am »
Without testing: assign the guid and update the element as usual. Didn't that work?

q.

sravang

  • EA User
  • **
  • Posts: 33
  • Karma: +0/-0
    • View Profile
Re: Part through API
« Reply #2 on: March 10, 2021, 04:22:51 pm »
MISCDATA is has only get property not set property. I mean it is read only property we cannot set that value.
« Last Edit: March 10, 2021, 05:08:08 pm by sravang »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Part through API
« Reply #3 on: March 10, 2021, 05:32:56 pm »
In that case you'll have to use the Repository.Execute method to update it

something like this:

Code: [Select]
string sqlUpdatePdata1 = "update t_connector set PDATA1 = '"+pdata1+"'"
            +" where ea_guid = '"+this.uniqueID+"'";
Repository.Execute(sqlUpdatePdata1);

The usual warning for using Execute apply. Use at your own risk.

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Part through API
« Reply #4 on: March 10, 2021, 06:40:50 pm »
Yeah, that's what I do all time anyway. So I forgot that MiscData is r/o.

q.