Book a Demo

Author Topic: ScenarioExtension  (Read 8352 times)

Jeremie0

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
ScenarioExtension
« on: September 18, 2014, 06:33:38 pm »
Hi everyone,

I'm trying to copy the alternate scenarios of a usecase
I've already copied the basic path but i don't know how to use the ScenarioExtension class


qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: ScenarioExtension
« Reply #1 on: September 18, 2014, 07:26:57 pm »
Could you be a bit more specific? How do you copy?

q.

Jeremie0

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
Re: ScenarioExtension
« Reply #2 on: September 18, 2014, 07:29:49 pm »
Actually it is more like
- new usecase
- new scenario
- copy steps from scenario source to scenario target

For now, the alternate scenario is copied but there are no joiningsteps

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: ScenarioExtension
« Reply #3 on: September 18, 2014, 09:41:12 pm »
Since you're posting in the automation forum you likely mean copy via API :-/

If so, can you post code snippets?

q.

Jeremie0

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
Re: ScenarioExtension
« Reply #4 on: September 18, 2014, 09:49:48 pm »
Code: [Select]
 foreach (Scenario source in element.Scenarios)
                                {
                                    EA.Scenario target = targets.AddNew(source.Name, source.Type);
foreach (ScenarioStep del in source.Steps)
                                            {
                                                ScenarioStep ScenarioSteptarget = targetsteps.AddNew(del.Name, del.Level); // on copie les etapes du scenario qui ont été cochées
                                                    ScenarioSteptarget.Update();
                                                    element2.Update();
                                                
                                            }
}
« Last Edit: September 18, 2014, 09:56:44 pm by Jeremie0 »

Jeremie0

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
Re: ScenarioExtension
« Reply #5 on: September 19, 2014, 01:00:35 am »
So how do I use the ScenarioExtension class ?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: ScenarioExtension
« Reply #6 on: September 19, 2014, 04:25:06 am »
I'd say you also need to copy the Extensions collection.

q.

P.S. Where did you learn to indent? At a place where you got free spaces? ;D
« Last Edit: September 19, 2014, 04:26:48 am by qwerty »

Jeremie0

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
Re: ScenarioExtension
« Reply #7 on: October 02, 2014, 07:01:48 pm »
how do i do that ?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: ScenarioExtension
« Reply #8 on: October 02, 2014, 07:57:43 pm »
Each scenario has a Scenario.Extensions collection. You need to iterate that and create new entries in the copy with identical contents. It's just the same as you did for the Scenarios collection itself.

q.

Jeremie0

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
Re: ScenarioExtension
« Reply #9 on: October 02, 2014, 10:50:34 pm »
Code: [Select]
foreach (ScenarioStep del in source.Steps)
                                            {

                                                    ScenarioStep ScenarioSteptarget = targetsteps.AddNew(del.Name, del.Level); // on copie les etapes du scenario qui ont été cochées

                                                    EA.Collection sourcexts = del.Extensions;


                                                    EA.Collection targexts = ScenarioSteptarget.Extensions;
                                                    foreach (ScenarioExtension sourcext in sourcexts)
                                                    {


                                                            EA.ScenarioExtension targext = ScenarioSteptarget.Extensions.AddNew(sourcext.Scenario.Name, sourcext.Scenario.Type);
                                                            targext.Join = sourcext.Scenario.ScenarioGUID;

                                                    }

                                                    ScenarioSteptarget.Update();
                                                    element2.Update();
                                                }

still not working but..why ?
« Last Edit: October 03, 2014, 12:20:26 am by Jeremie0 »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: ScenarioExtension
« Reply #10 on: October 03, 2014, 12:34:19 am »
You don't call update after creating the extension.

q.

Jeremie0

  • EA User
  • **
  • Posts: 25
  • Karma: +0/-0
    • View Profile
Re: ScenarioExtension
« Reply #11 on: October 03, 2014, 12:37:46 am »
i keep getting the error DAO.Recordset [3022]

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: ScenarioExtension
« Reply #12 on: October 03, 2014, 06:16:35 am »