Initializing help system before first use

# ScenarioDataChange

Captures and commits changes to the data of a Scenario

### Method summary

name | description
--- | ---
addToSet | Add an element to the specified set.
commit | Commit the changes applied to this scenario data change object.
removeFromArray | Remove elements in an Insight Array.
removeFromSet | Removes an element from the specified set.
setArrayElement | Sets the values of elements in an Insight array.
setParameter | Sets a parameter.
setScalar | Update a scalar value for the associated scenario.

### Methods

addToSet ( name, values, dimension ) → {ScenarioDataChange}

  Add an element to the specified set.

  ##### Parameters:

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  name | string |  |  | The name of the set entity
  values | PrimitiveType | Array.<PrimitiveType> |  |  | one or more new values to add to the set
  dimension | insight.enums.EntityDataDimension | optional | insight.enums.EntityDataDimension.NORMAL_DATA | The dimension to update

  Returns:

  Type | Description
  --- | ---
  ScenarioDataChange | Returns the data change object so calls can be chained

  ##### Example

      var dataTracker = scenario.modify();
      dataTracker.addToSet('SET_NAME', [99,100,101]).commit();

  Back to Top
commit ( ) → {Promise}

  Commit the changes applied to this scenario data change object.

  Returns:

  Type | Description
  --- | ---
  Promise | Resolves once the scenario has been updated on the server. Rejected with an error object if and error is encountered in the data change request or on the server whilst saving the data.

  ##### Example

      var dataChange = scenario.modify();
      // call some 'setX' methods to request data changes to happen
      dataChange.commit();

  Back to Top
removeFromArray ( name, indices, dimension ) → {ScenarioDataChange}

  Remove elements in an Insight Array.

  To remove a single element a single indices should be provided. To remove multiple elements, an array of indices should be provided.

  ##### Parameters:

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  name | string |  |  | The name of the array entity
  indices | Array.<PrimitiveType> | Array.<Array.<PrimitiveType>> |  |  | The keys of the elements to delete, each key is an array of indices
  dimension | insight.enums.EntityDataDimension | optional | insight.enums.EntityDataDimension.NORMAL_DATA | The dimension to update

  Returns:

  Type | Description
  --- | ---
  ScenarioDataChange | Returns the data change object so calls can be chained

  ##### Example

      scenario
           .modify()
           .removeFromArray('IntegerArrayEntity', [99]) // remove a single element from an array
           .removeFromArray('IntegerArrayEntity', [[99], [100], [104], [999]]) // remove several elements from an array
           .commit(); // send batch request

  Back to Top
removeFromSet ( name, values, dimension ) → {ScenarioDataChange}

  Removes an element from the specified set.

  ##### Parameters:

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  name | string |  |  | The name of the set entity
  values | PrimitiveType | Array.<PrimitiveType> |  |  | one or more values to remove from the set
  dimension | insight.enums.EntityDataDimension | optional | insight.enums.EntityDataDimension.NORMAL_DATA | The dimension to update

  Returns:

  Type | Description
  --- | ---
  ScenarioDataChange | Returns the data change object so calls can be chained

  Back to Top
setArrayElement ( name, elements, dimension ) → {ScenarioDataChange}

  Sets the values of elements in an Insight array.

  Each element is specified as a structure comprising the key (indices) and the value.

  To set a single element a single element should be provided. To set multiple elements, an array of elements should be provided.

  ##### Parameters:

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  name | string |  |  | The name of the array entity
  elements | Array.<Object.<{key: Array.<PrimitiveType>, value: PrimitiveType, dimension: (insight.enums.EntityDataDimension|undefined)}>> | Object.<{key: Array.<PrimitiveType>, value: PrimitiveType, dimension: (insight.enums.EntityDataDimension|undefined)}> |  |  | Either a single array element or an array of the elements, comprising of their indices, value and dimension(optional)
  dimension | insight.enums.EntityDataDimension | optional | insight.enums.EntityDataDimension.NORMAL_DATA | The dimension to update

  Returns:

  Type | Description
  --- | ---
  ScenarioDataChange | Returns the data change object so calls can be chained

  ##### Example

      scenario
           .modify()
           .setArrayElement('IntegerArrayEntity', {key: [99], value: 1000}) // add or overwrite an array element
           .commit(); // send batch request

  Back to Top
setParameter ( name, value ) → {ScenarioDataChange}

  Sets a parameter.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  name | string | The parameter name
  value | string | A string representing the new value for the parameter

  Returns:

  Type | Description
  --- | ---
  ScenarioDataChange | Returns the data change object so calls can be chained

  Back to Top
setScalar ( name, value, dimension ) → {ScenarioDataChange}

  Update a scalar value for the associated scenario.

  ##### Parameters:

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  name | string |  |  | The name of the scalar entity
  value | string | number | boolean | null |  |  | The new scalar value
  dimension | insight.enums.EntityDataDimension | optional | insight.enums.EntityDataDimension.NORMAL_DATA | The dimension to update

  Returns:

  Type | Description
  --- | ---
  ScenarioDataChange | Returns the data change object so calls can be chained

  ##### Example

      var scenarioDataChange = scenario.modify();
      scenarioDataChange.setScalar('SCALAR_ONE', 25);

  Back to Top

Parent Topic Classes

© 2001-2026 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.