Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: MMiletic on August 04, 2023, 11:53:26 pm

Title: Changing value of TaggedValue
Post by: MMiletic on August 04, 2023, 11:53:26 pm
Hello
does anybody know how to change value of TaggedValue.
So basically I want to do something like this.

req = eaRepo.GetElementByGuid("{...}")
req.TaggedValues.GetAt(0) = "Test" # this doesn't work

BR and thank you in advance for your help  :)
M.
Title: Re: Changing value of TaggedValue
Post by: qwerty on August 05, 2023, 12:39:31 am
You will need an Udate as well.

q.
Title: Re: Changing value of TaggedValue
Post by: MMiletic on August 06, 2023, 09:37:12 pm
hey q, thank you for help.
Okay I understand that, but the problems is:
    req.TaggedValues.GetAt(0) = "Test"
    ^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: cannot assign to function call here. Maybe you meant '==' instead of '='?

I don't know how to set value of req.TaggedValues.GetAt(0).
Title: Re: Changing value of TaggedValue
Post by: qwerty on August 07, 2023, 01:43:35 am
You need to assign the right object (which getAt delivers). IIRC this has a property Value you need to assign. Somethinng like

Code: [Select]
obj = req.TaggedValues.GetAt(0)
obj.value = "Test"
obj.update()

(Don't nail me on syntax)

q.
Title: Re: Changing value of TaggedValue
Post by: MMiletic on August 08, 2023, 02:48:39 am
Thanks q, that works  :)