Book a Demo

Author Topic: API to create a predefined tagged value  (Read 4548 times)

whitehouse

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
API to create a predefined tagged value
« on: February 20, 2014, 04:02:35 pm »
I'm a new in Sparx and developing a Sparx Addin.
I would like to ask is there any API to create a predefined tagged value?
Thank you.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: API to create a predefined tagged value
« Reply #1 on: February 20, 2014, 05:43:22 pm »
Element.TaggedValues.AddNew()

Geert

Nizam Mohamed

  • EA User
  • **
  • Posts: 193
  • Karma: +1/-0
    • View Profile
Re: API to create a predefined tagged value
« Reply #2 on: February 20, 2014, 06:38:29 pm »
To define a predefined tagged value you can use the "PropertyTypes" collection from Repository

Sample below
Code: [Select]
     ' Add a project Tag
      dim tags as EA.Collection
      set tags = Repository.PropertyTypes
      
      dim prop as EA.PropertyType
      set prop = tags.AddNew("BoolTag","Boolean Tag")
      prop.Description="Boolean Tag"
      prop.Detail= "Type=Boolean;"
      prop.Tag="Bool"

whitehouse

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Re: API to create a predefined tagged value
« Reply #3 on: February 20, 2014, 06:57:44 pm »
Quote
To define a predefined tagged value you can use the "PropertyTypes" collection from Repository

Sample below
Code: [Select]
     ' Add a project Tag
      dim tags as EA.Collection
      set tags = Repository.PropertyTypes
      
      dim prop as EA.PropertyType
      set prop = tags.AddNew("BoolTag","Boolean Tag")
      prop.Description="Boolean Tag"
      prop.Detail= "Type=Boolean;"
      prop.Tag="Bool"

Thank you. You make our vibrant community.
I applied your snipplet
Code: [Select]
EA.PropertyType predefinedProjectEnumTag = repository.PropertyTypes.AddNew("tag name", "Sample predefined tagged value");
predefinedProjectEnumTag.Detail = "Type = Enum; Values = project; Default = project; BaseStereotype = ArchiMate_WorkPackage;";
predefinedProjectEnumTag.Update();