Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Dieter Goetz on December 02, 2015, 12:09:32 am

Title: Getting parameter's tagged values
Post by: Dieter Goetz on December 02, 2015, 12:09:32 am
Hi,

how can I read tagged values from parameter using the EA SDK?

This code will threw an exception:

//parameter is of type EA.parameter and existing
//Min is also existing
EA.TaggedValue tagValue = parameter.TaggedValues.GetByName("Min");

The same line of code for other EA elements is working.
Title: Re: Getting parameter's tagged values
Post by: qwerty on December 02, 2015, 12:50:31 am
The getByName does not work for all collections. Try iterating instead. Also note that there might be more than one TV with the same name!

q.
Title: Re: Getting parameter's tagged values
Post by: Dieter Goetz on December 02, 2015, 02:35:18 am
Iterating will not work neither. The return can not casted to a tagged value.

EA.TaggedValue tagValue;
for (short i = 0; i < parameter.TaggedValues.Count;  i++)
{
    tagValue = parameter.TaggedValues.GetAt(i);
}

Title: Re: Getting parameter's tagged values
Post by: robinch on December 02, 2015, 02:53:55 am
How about something like:

Code: [Select]
EA.ParamTag tag;
for (short i = 0; i < parameter.TaggedValues.Count;  i++)
{
    tag = parameter.TaggedValues.GetAt(i);
}
Title: Re: Getting parameter's tagged values
Post by: Dieter Goetz on December 02, 2015, 03:28:08 am
Great, EA.ParamTag is working. Thanks a lot,