forio Toggle navigation

Saved Runs Manager

The Saved Runs Manager is a specific type of Run Manager which provides access to a list of runs (rather than just one run). It also provides utility functions for dealing with multiple runs (e.g. saving, deleting, listing).

An instance of a Saved Runs Manager is included automatically in every instance of a Scenario Manager, and is accessible from the Scenario Manager at .savedRuns. See more information on using .savedRuns within the Scenario Manager.

Constructor options

Required? Name Type Description
Yes scopeByGroup boolean If set, will only pull runs from current group. Defaults to true.
Yes scopeByUser boolean If set, will only pull runs from current user. Defaults to true. For multiplayer run comparison projects, set this to false so that all end users in a group can view the shared set of saved runs.

Methods

save(run[, otherFields])

Marks a run as saved.

Note that while any run can be saved, only runs which also match the configuration options scopeByGroup and scopeByUser are returned by the getRuns() method.

Parameters

Required? Name Type Description
Yes run String / RunService Run to save. Pass in either the run id, as a string, or the Run Service.
  otherFields object Any other meta-data to save with the run.

Example

var sm = new F.manager.ScenarioManager();
sm.savedRuns.save('0000015a4cd1700209cd0a7d207f44bac289');

remove(run[, otherFields])

Marks a run as removed; the inverse of marking as saved.

Parameters

Required? Name Type Description
Yes run String / RunService Run to remove. Pass in either the run id, as a string, or the Run Service.
  otherFields object any other meta-data to save with the run.

Example

var sm = new F.manager.ScenarioManager();
sm.savedRuns.remove('0000015a4cd1700209cd0a7d207f44bac289');

mark(run, toMark)

Sets additional fields on a run. This is a convenience method for RunService#save.

Parameters

Required? Name Type Description
Yes run String / Array.<string> / RunService Run to operate on. Pass in either the run id, as a string, or the Run Service.
Yes toMark Object Fields to set, as name : value pairs.

Example

var sm = new F.manager.ScenarioManager();
sm.savedRuns.mark('0000015a4cd1700209cd0a7d207f44bac289', 
    { 'myRunName': 'sample policy decisions' });

getRuns([variables, filter, modifiers])

Returns a list of saved runs.

Parameters

Required? Name Type Description
  variables Array.<string> If provided, in the returned list of runs, each run will have a .variables property with these set.
  filter object Any filters to apply while fetching the run. See RunService#filter for details.
  modifiers object Use for paging/sorting etc. See RunService#filter for details.

Example

var sm = new F.manager.ScenarioManager();
sm.savedRuns.getRuns().then(function (runs) {
    for (var i=0; i<runs.length; i++) {
        console.log('run id of saved run: ', runs[i].id);
    }
});