Book a Demo

Author Topic: element.HasAttributes() vs structured tags  (Read 2853 times)

Russell

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
element.HasAttributes() vs structured tags
« on: September 26, 2018, 04:02:31 am »
Hi,

I'm trying to manipulate structured tags via scripting.  From http://sparxsystems.com/enterprise_architect_user_guide/13.0/automation/taggedvalue.html, I see that HasAttributes() should report true if a tag is structured.

I've created an element and added to it a structured tag call "MAM::example".  That structured tag is defined as:
Code: [Select]
Type=Boolean;
Default=True;


The handler I've created for experimenting with inspecting the structured tag is as follows:
Code: [Select]

...

function getMamExampleTag(theElement) {

var result;

if ( theElement != null )
{
var taggedValue as EA.TaggedValue;
taggedValue = theElement.TaggedValues.GetByName( "MAM::example" );

if (taggedValue != null ) {
Session.Output("element.name  = " + taggedValue.Name);
Session.Output("element.value = " + taggedValue.Value);
Session.Output("element.HasAttributes() = " + taggedValue.HasAttributes() );

} else {
Session.Output("element = null");
}
}
}

When running this script against the element, the following output results:
Code: [Select]
element.name  = MAM::example
element.value = True
element.HasAttributes() = false

So, in this case, HasAttributes() reports false, even though I know the tag to be structured, and even though the value reports True as per the default in the structured tag.

Can someone help me to understand where I'm going wrong?   

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: element.HasAttributes() vs structured tags
« Reply #1 on: September 26, 2018, 05:40:24 am »
According to the documentation, HasAttributes returns True if the tagged value is structured (with one or more properties).

q.

Russell

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: element.HasAttributes() vs structured tags
« Reply #2 on: September 26, 2018, 08:43:53 pm »
Ah. Right. My bad.

Thanks :)