Book a Demo

Author Topic: Change flowport type by script  (Read 5823 times)

PeteC

  • EA User
  • **
  • Posts: 91
  • Karma: +1/-0
    • View Profile
Change flowport type by script
« on: September 27, 2012, 12:14:23 am »
Is it possible to change the type on a flowport by a script?

I have got the GUID of the type that I want to set and realise that it the GUID identifying the type is held in PDATA1, aka MiscData(0), but that is a read-only property.

The alternative is going to be to programmatically create a new flowport in the same physical location and transfer the connectors from the old flowport before deleting it.

Paulus

  • EA User
  • **
  • Posts: 152
  • Karma: +0/-0
    • View Profile
Re: Change flowport type by script
« Reply #1 on: September 27, 2012, 02:00:44 am »
Hi Pete,

I'm not sure what you mean by flowport but at any rate, you can easily update its type by using an SQL update statement. Use the undocumented Repository.ExecuteSQL for this and be sure to make a copy of your database before you start experimenting with this (in case you mess up trying  ;)). The table involved is t_object.

best regards,

Paulus

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Change flowport type by script
« Reply #2 on: September 27, 2012, 09:01:44 pm »
If you mean "direction of" by "type of a flow port" you need to modify the according tagged value. Else you should explain "type".

q.

PeteC

  • EA User
  • **
  • Posts: 91
  • Karma: +1/-0
    • View Profile
Re: Change flowport type by script
« Reply #3 on: September 27, 2012, 09:38:27 pm »
By "type" I meant the Type field that is accessed by right-clicking on the flowport, selecting Properties and in the "Property" page under "Properties" (sorry about all the Properties but that's the way the dialog is organised), there is Type, with a drop-down list of Boolean, Integer, Real, Strind etc.

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Change flowport type by script
« Reply #4 on: September 28, 2012, 09:00:33 am »
The OP is correct: the Property Type of a port is stored as a GUID in t_object.PDATA1 which is EA.Element.MiscData(0) in the EA object model and read-only.
« Last Edit: September 28, 2012, 09:02:23 am by KP »
The Sparx Team
[email protected]

Paulus

  • EA User
  • **
  • Posts: 152
  • Karma: +0/-0
    • View Profile
Re: Change flowport type by script
« Reply #5 on: September 28, 2012, 09:38:29 am »
true but an SQL update statement will bypass the GUI and considering its a simple update on a column i dont see the problem with that in this specific case.

Mind you im not saying its a good idea to by-pass the GUI for updates, but if you are otherwise stuck it is worth investigating as an option.

best regards,


Paulus