Book a Demo

Author Topic: Getting step input from "entry points"  (Read 4614 times)

Stenvang

  • EA User
  • **
  • Posts: 50
  • Karma: +0/-0
    • View Profile
Getting step input from "entry points"
« on: August 13, 2014, 09:54:06 pm »
Working on a add-in that can take out the scenariosteps and put it into a table in word.
I'm having some problems if the scenariosteps contain a alternate path. I can't pull out the step where the alternate path begins?
e.g:
- A scenario contains 3 steps, with a alternate path
1
2 - step 2 has a alternate path named "2a" and I want to pull out that name "2a"
3

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Getting step input from "entry points"
« Reply #1 on: August 14, 2014, 03:57:05 am »
You need to check scenario.extensions. My Scripting book as an example how to create a scenario with extensions:

Quote
alt = element.Scenarios.AddNew ("alternate", "Alternate");
altS = alt.Steps.AddNew ("alt step1", "1");
altS.Update();
scenario.Update();

scenario = element.Scenarios.AddNew ("scenario", "Basic Path");
s = scenario.Steps.AddNew ("step1", "1");
s.Update();
ext = s.Extensions.AddNew ("", alt.ScenarioGUID);
if (tilEnd) ext.Join = "";
else ext.Join = s.StepGUID;
ext.Update();
scenario.Update();

q.

Stenvang

  • EA User
  • **
  • Posts: 50
  • Karma: +0/-0
    • View Profile
Re: Getting step input from "entry points"
« Reply #2 on: August 14, 2014, 04:55:43 pm »
I think you might misunderstood me. I have already created my steps and so on with alternate paths in Enterprise Architect. The problem is that I can't pull out that "2a" from the scenario. The alternate path has a name and a step where  the alternate path begins, but I can't find a way through c# code to refer to that step.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Getting step input from "entry points"
« Reply #3 on: August 14, 2014, 07:05:07 pm »
I posted the above code for creation so you can deduce the point where and how to retrieve it. It's just that you need to iterate the Extensions collection.

q.

Stenvang

  • EA User
  • **
  • Posts: 50
  • Karma: +0/-0
    • View Profile
Re: Getting step input from "entry points"
« Reply #4 on: August 15, 2014, 06:23:37 pm »
It just seem strange to me that if I iterate through the Scenario collection I find everything about the alternate scenario but that step number.
Lets say I got an alternate scenario with the name: "Alternate1" and it begins at step "2a", then I iterate the scenario collection as following:

Foreach (Scenario sc in Element.Scenarios)
{
       sc.name; //Gives "Alternate1"
       sc.ObjectType; //Gives the type "Alternate"
}

But there is no way I can get that step in this collection?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Getting step input from "entry points"
« Reply #5 on: August 15, 2014, 08:15:27 pm »
There is an Extension collection in a scenario step. You need to iterate that to get it. The structured scenarios allow for one level of extensions. That is why I recommend to use the notes and numbered bullet points since this is, though more tedious, flexible in terms of scenario structure.

q.