Book a Demo

Author Topic: Requirements & Auto Name Counters  (Read 2839 times)

chris_

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Requirements & Auto Name Counters
« on: June 22, 2011, 06:38:53 pm »
Hi,

I use for my project the automatic generation from aliases for the requirements... but I have only activated the auto name counters / alias for them after I have already written some one.... :o

Is there a possibility to assign automatically aliases for existing requirements? is there an EA function for that? or there is no over way to do this as doing it manually?  :-/

Thanks

Chris_

Luis J. Lobo

  • EA User
  • **
  • Posts: 252
  • Karma: +0/-0
  • IT Consultant
    • View Profile
Re: Requirements & Auto Name Counters
« Reply #1 on: June 22, 2011, 06:47:48 pm »
Make a VB Script (scripting window) with something like this:
------------------------------

Dim ThePackage as EA.Package
Dim TheElement as EA.Element
Dim CodReq
Dim i

Set ThePackage = Repository.GetTreeSelectedPackage()
CodReq = 1
For i = 0 to ThePackage.Elements.Count - 1
     Set TheElement = ThePackage.Elements.GetAt(i)
     If TheElement.Type = "Requirement" and TheElement.Alias <> "" Then
          TheElement.Alias = "Req" & CodReq
          TheElement.Update()
          CodReq = CodReq + 1
     End If
Next
msgbox "Requirements updated"

----------------------------
Regards,

Luis

chris_

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: Requirements & Auto Name Counters
« Reply #2 on: June 22, 2011, 06:58:59 pm »
Thanks for the quick answer!  :)
I will try it!

Regards

Chris_