Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Dalia on February 20, 2014, 11:46:46 pm
-
Hi all,
I've been trying to add parameters to an InfrastructureService.
To do that I've implemented the following function to create the activityParameter and to update the direction property value. direction is an input parameter to this function and can have the values in/out/inout.
function AddParameter (objparent, nome, direction)
set parm = nothing
if objparent is nothing then
set parm = objparent.Elements.AddNew(nome, "ActivityParameter")
parm.update()
for each c in parm.customproperties
if strcomp(c.name, "direction")=0 then
c.value = direction
end if
next
parm.update()
end if
set AddParameter = parm
end function
What I state calling this function is that the direction parameter always assumes the last set value independently of the ActivityParameter being created/manipulate. For instance, after executing the following code
set theParameter = AddParameter (root, "teste1", "in")
set theParameter = AddParameter (root, "teste2", "out")
set theParameter = AddParameter (root, "teste3", "inout")
set theParameter = AddParameter (root, "teste4", "inout")
teste1, teste2, teste3 and teste4 all have the "inout" value in the direction parameter.
I've tested this in version 10 and 11.
Can you please help?
-
In the mean time I changed the function to the one below an it is working not being sure why did it start to work.
function AddParameter (objparent, nome, direction)
set parm = nothing
if not (objparent is nothing) then
set parm = objparent.Elements.AddNew(nome, "ActivityParameter")
parm.update()
for each c in parm.customproperties
if strcomp(c.name, "direction")=0 then
c.value = direction
end if
next
if not(parm.update()) then
session.output "error"
end if
end if
set AddParameter = parm
end function
-
I just tried it and had no problem. So likely you must be doing something wrong. Likely it's something in that hidden AddParameter method.
q.
P.S. So I was right ;D