Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: pb17 on September 20, 2024, 10:41:29 pm
-
Hello everyone,
I'm working on a script to automate the updating of Parameter Type in the ActivityParameter Elements. These can be set to types such as "String", "Integer", "Real", (...) "<none>".
I'm specifically trying to set it to '<none>', but I'm having trouble accessing this element Parameter via script. Does anyone have any tips or know how to accomplish this?
Thank you in advance
-
Looks like it's part of the custom properties.
It's stored in t_xref in the description field like this:
@PROP=@NAME=default@ENDNAME;@TYPE=String@ENDTYPE;@VALU=bla bla@ENDVALU;@PRMT=@ENDPRMT;@ENDPROP;@PROP=@NAME=isConst@ENDNAME;@TYPE=Boolean@ENDTYPE;@VALU=True@ENDVALU;@PRMT=@ENDPRMT;@ENDPROP;@PROP=@NAME=isStream@ENDNAME;@TYPE=boolean@ENDTYPE;@VALU=0@ENDVALU;@PRMT=@ENDPRMT;@ENDPROP;@PROP=@NAME=isException@ENDNAME;@TYPE=boolean@ENDTYPE;@VALU=0@ENDVALU;@PRMT=@ENDPRMT;@ENDPROP;
I'm pretty sure you can access values using EA.Element.CustomProperties
Geert
-
Looks like it's part of the custom properties.
[...]
I'm pretty sure you can access values using EA.Element.CustomProperties
But documentation on https://sparxsystems.com/enterprise_architect_user_guide/17.0/add-ins___scripting/element2.html states:
"Currently only editable from the user interface."
so updating the value (here: to "<none>") might be impossible this way.
-
Yes, it looks that way.
If I were you, I would test for the value using the customproperties, and then use an SQL update statement to change the value.
You can use the undocumented method Repository.Execute(sqlUpdateString) to execute your update.
Be careful however to not break things. Repository.Execute is like playing with matches in a room full of fireworks.
Geert
-
Hi Greet!
Thank you so much for the feedback.
Sorry for the delay in my response.
I´ve tried to iterate and get the information for the custom properties, but none has this information.
I can get the information about the:
isStream
isException
default
effect
direction
isConst
isOrdered
isUnique
isControlType
It looks like it is not possible to update via script.
-
Hi Greet!
It Geert, not Greet
It looks like it is not possible to update via script.
If you look at the customproperties of the Activity, you'll find the types of the parameters.
How exactly this ties tot he ActivityParameters; I haven't figured out.
Updating is possible in a script, but you'll need to use Repository.Execute
Geert
-
I apologize for the mistake. I have dyslexia, and it's something I struggle with.
I will take a closer look at the custom properties of the activity.
Thank you again for your support!