Programatically list/delete/test existence of model scenario
Posted: Tue Aug 14, 2012 6:07 am
Within a given model object is it possible to list the different scenarios, get a count of scenarios in the model, traverse the list of scenarios and delete scenarios that need to be rebuilt.
Ultimately what I want to do is test to see if a scenario exists, and then delete it so I can recreate it. Since a model object stores to a db with scenarios intact, I have no way to know whether the model object was stored with the scenario intact, then when I go to build an updated model worfile, part of that process is to put in updated scenarios. Instead what I wind up doing is deleting the model every time and then increasing my error count since deleting a non-existant scenario throws an error.
m_mymodel.scenario(d) "Scenario 1"
Incidentally, since I'm having to do some creative contribution analysis, what is the maximum number of scenarios that a model object can have in it?
Ultimately what I want to do is test to see if a scenario exists, and then delete it so I can recreate it. Since a model object stores to a db with scenarios intact, I have no way to know whether the model object was stored with the scenario intact, then when I go to build an updated model worfile, part of that process is to put in updated scenarios. Instead what I wind up doing is deleting the model every time and then increasing my error count since deleting a non-existant scenario throws an error.
m_mymodel.scenario(d) "Scenario 1"
Incidentally, since I'm having to do some creative contribution analysis, what is the maximum number of scenarios that a model object can have in it?