Share
 
 

Scenarios

Use in queries

The following modifiers:

  • IN BASE SCENARIO
  • IN CURRENT SCENARIO
  • IN SCENARIO '<name>'
  • iN SCENARIO $scalar

can be applied as follows:

In select clauses:

SELECT IN BASE SCENARIO WHERE <expression>

SELECT IN SCENARIO 'net1' WHERE <expression>

The expression can be omitted in which case everything in that scenario is selected, e.g.

SELECT IN SCENARIO 'net2'

This can be combined with the existing SELECTED and ALL keywords and the overriding of table names, e.g.

SELECT SELECTED FROM [All Nodes] IN BASE SCENARIO WHERE x > 644000

'Delete' and 'Deselect' clauses behave the same way, e.g.

DELETE ALL FROM [All Nodes] IN SCENARIO 'net2' WHERE x > 644000

DESELECT ALL FROM [All Nodes] IN SCENARIO 'net2' WHERE x < 644000

Update clauses behave the same way, with the same modifiers in conjunction with the existing SELECTED and ALL keywords and the overriding of table names, e.g.

UPDATE IN SCENARIO 'net2' set user_number_1 = 123

UPDATE [All Links] IN SCENARIO 'net2' set user_number_1 = 123

UPDATE SELECTED [All Links] IN SCENARIO 'net2' set user_number_1 = 123

Variables can be used in scenarios - there is only one copy of each variable, there are no scenario dependent variables.

To set a variable based on an expression in a scenario the same syntax is used, e.g.

UPDATE IN SCENARIO 'net1' SET $x = user_number_1

This provides a mechanism for comparing values in scenarios, e.g.

UPDATE IN SCENARIO 'net1' SET $x = user_number_1;

SELECT WHERE $x <> user_number_1

Creation of scenarios

Scenarios can be added as follows:

ADD SCENARIO 'name'

ADD SCENARIO $variable

The scenario can optionally be based on another by adding:

BASED ON 'name'

or

BASED ON 'variable'

Deletion of scenarios

Scenarios can be removed as follows:

DROP SCENARIO 'name'

DROP SCENARIO $variable

Was this information helpful?