Apperyio.storage.variableName.get()
Returns value of a specified storage variable.
#Parameters summary The method has the following parameter(s):
Parameter | Description | Required |
---|---|---|
path |
JavaScript expression to return specific object field. |
No. |
#Examples
Let's say storage variable Product holds the following data:
{"partNumber": 1000, "name": "Smartphone"}
The following will return the entire expression stored in the variable (click on Result tab):
Apperyio.storage.Product.get();
{"partNumber": 1000, "name": "Smartphone"}
The following will return the specified field. This examples uses a Mapping Expression.
Apperyio.storage.Product.get("$['name']");
Smartphone
If you have a more complex structure such as shown below:
{
"ProductList": [
{
"partNumber": 1000,
"name": "Smartphone"
},
{
"partNumber": 2000,
"name": "Tablet"
}
]
}
You can run a query that looks like this:
Apperyio.storage.ProductList.get("$['products'][1]");
{
partNumber: 2000,
name: "Tablet"
}
You can also get a specific field from a selected object:
Apperyio.storage.ProductList.get("$['products'][1]['partNumber']");
2000
Use the following code to obtain a model name from a storage variable:
var type = Apperyio.storage.storageVariable.type;