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:
paramsName Type Argument Default Description name typestringThe name of the set entity values typePrimitiveType | Array.<PrimitiveType>one or more new values to add to the set dimension typeinsight.enums.EntityDataDimensionoptional insight.enums.EntityDataDimension.NORMAL_DATA The dimension to update detailsReturns:returns tableType Description typeScenarioDataChangeReturns the data change object so calls can be chained Example
examples
Back to Topvar dataTracker = scenario.modify(); dataTracker.addToSet('SET_NAME', [99,100,101]).commit();
- commit ( ) → {Promise}
-
Commit the changes applied to this scenario data change object.
detailsReturns:returns tableType Description typePromiseResolves 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
examples
Back to Topvar dataChange = scenario.modify(); // call some 'setX' methods to request data changes to happen dataChange.commit();
- 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:
paramsName Type Argument Default Description name typestringThe name of the array entity indices typeArray.<PrimitiveType> | Array.<Array.<PrimitiveType>>The keys of the elements to delete, each key is an array of indices dimension typeinsight.enums.EntityDataDimensionoptional insight.enums.EntityDataDimension.NORMAL_DATA The dimension to update detailsReturns:returns tableType Description typeScenarioDataChangeReturns the data change object so calls can be chained Example
examples
Back to Topscenario .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
- removeFromSet ( name, values, dimension ) → {ScenarioDataChange}
-
Removes an element from the specified set.
Parameters:
paramsName Type Argument Default Description name typestringThe name of the set entity values typePrimitiveType | Array.<PrimitiveType>one or more values to remove from the set dimension typeinsight.enums.EntityDataDimensionoptional insight.enums.EntityDataDimension.NORMAL_DATA The dimension to update detailsReturns:returns tableType Description typeScenarioDataChangeReturns the data change object so calls can be chained - 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:
paramsName Type Argument Default Description name typestringThe name of the array entity elements typeArray.<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 typeinsight.enums.EntityDataDimensionoptional insight.enums.EntityDataDimension.NORMAL_DATA The dimension to update detailsReturns:returns tableType Description typeScenarioDataChangeReturns the data change object so calls can be chained Example
examples
Back to Topscenario .modify() .setArrayElement('IntegerArrayEntity', {key: [99], value: 1000}) // add or overwrite an array element .commit(); // send batch request
- setParameter ( name, value ) → {ScenarioDataChange}
-
Sets a parameter.
Parameters:
paramsName Type Description name typestringThe parameter name value typestringA string representing the new value for the parameter detailsReturns:returns tableType Description typeScenarioDataChangeReturns the data change object so calls can be chained - setScalar ( name, value, dimension ) → {ScenarioDataChange}
-
Update a scalar value for the associated scenario.
Parameters:
paramsName Type Argument Default Description name typestringThe name of the scalar entity value typestring | number | boolean | nullThe new scalar value dimension typeinsight.enums.EntityDataDimensionoptional insight.enums.EntityDataDimension.NORMAL_DATA The dimension to update detailsReturns:returns tableType Description typeScenarioDataChangeReturns the data change object so calls can be chained Example
examples
Back to Topvar scenarioDataChange = scenario.modify(); scenarioDataChange.setScalar('SCALAR_ONE', 25);
method
method
method
method
method
method
method