update

Apperyio.storage.variableName.update(path, value)

Updates specified storage variable by provided path with a specified value.

#Parameters summary The method has the following parameter(s):

Parameter Description Required

path

Path in form of a Mapping Expression to value that should be updated.

Yes.

value

New value.

Yes.

#Examples

Let's say a storage variable Product holds the following data:

{
 "partNumber": 1000, 
 "name": "Smartphone"
}

The following code will update the name field:

Apperyio.storage.Product.update("$['name']", "Smart Watch");
var p = Apperyio.storage.Product.get();
console.log(p);
{
  "name": "Smart Watch",
  "partNumber": 1000
}

Here is another example but this time using a variable:

var fieldName = "name";
Apperyio.storage.Product.update("$['"+fieldName+"']", "Smart Watch");
var p = Apperyio.storage.Product.get();
console.log(p);
{
  "name": "Smart Watch",
  "partNumber": 1000
}