Book a Demo

Author Topic: Impossible to delete structured Steps  (Read 3760 times)

Luis J. Lobo

  • EA User
  • **
  • Posts: 252
  • Karma: +0/-0
  • IT Consultant
    • View Profile
Impossible to delete structured Steps
« on: May 25, 2011, 05:30:31 pm »
The followingVBScript code (and similar ones I've tried) doesn't work:

Code: [Select]
option explicit

!INC Local Scripts.EAConstants-VBScript

sub main
      dim pSteps as EA.Collection
      dim pStep as EA.Scenario
      dim TheUseCase as EA.Element
      dim pScenario as EA.Scenario
      dim strNameStep
      dim strFound
      dim bFound
      dim bError
      dim i
      
      set TheUseCase = Repository.GetTreeSelectedObject
      set pScenario = TheUseCase.Scenarios.GetAt(0)
      set pSteps = pScenario.Steps
      pSteps.Refresh()
      strFound = "Step 3"
      bFound = false
      i = 0
      while (not bError and i < pSteps.Count and not bFound)
            set pStep = pScenario.Steps.GetAt(i)
            strNameStep = pStep.Name
            if strFound = strNameStep then
                  pSteps.Delete(i)
                  pSteps.Refresh()
                  bFound = true
            end if
            i = i + 1
      wend                                          
end sub

main

Although this is an script, I've tested it in C# add-in mode and doesn't work.

Any idea?

Thanks in advance,

Luis
« Last Edit: May 25, 2011, 05:32:56 pm by Deiser »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Impossible to delete structured Steps
« Reply #1 on: May 25, 2011, 05:36:35 pm »
Luis,

Have you tried to add a pScenario.Update() statement in between?

Geert

Luis J. Lobo

  • EA User
  • **
  • Posts: 252
  • Karma: +0/-0
  • IT Consultant
    • View Profile
Re: Impossible to delete structured Steps
« Reply #2 on: May 25, 2011, 05:52:53 pm »
Yes, before and after the "pSteps.Refresh()" statement, and the step is not deleted anyway.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Impossible to delete structured Steps
« Reply #3 on: May 25, 2011, 06:08:43 pm »
In that case there's a good chance it is a plain and simple bug.
I think I've seen things like that in the past as well.

Geert

Luis J. Lobo

  • EA User
  • **
  • Posts: 252
  • Karma: +0/-0
  • IT Consultant
    • View Profile
Re: Impossible to delete structured Steps
« Reply #4 on: May 25, 2011, 06:19:21 pm »
Thanks, Geert.

Reported to sparx.