ApplicationExperienceEdge 1.0.0

Storage: Get Value Node

The Storage: Get Value Node allows a workflow to retrieve a value stored in a previous run of the workflow by the Storage: Set Value Node. Stored values can also be viewed and manipulated using the workflow storage tab.

Storage Get Value Node

Node Properties

There are two different ways to use this node, you can either fetch a particular storage value for a workflow, or fetch all storage values for a workflow.

Fetch all currently stored values

Storage Get Value Node Fetch All

When this option is selected, there is only one additional option to configure.

  • Result Path: This is the payload path at which the workflow will place the retrival result. The workflow will create an object of key/value pairs, where the keys are the workflow storage keys and the values are the associated workflow storage values. That object will be placed at this specified spot on the payload.

NOTE: the ability to fetch all storage values for edge workflows is only available in Edge Agent Version 1.10.0 and higher.

Fetch a single stored value

Storage Get Value Node Fetch Single

When this option is selected, there are a few additional options to configure.

  • Key: This is the particular workflow storage key to retrieve. It can be a string template, and while it can be an arbitrary string, it should match the identifier of a previously stored value - i.e., the identifier used in the configuration of a Storage: Set Value Node.
  • Default Value Type: This defines how the workflow should interpret the Default Value field. The options are Payload Path, String Template, and JSON Template.
  • Default Value: When the Key given is not actually a key that exists in the workflow storage, this value comes into play. The value of this field will be used as the default value for the Key when it is not found.

    • When Default Value Type is String Template, this value in this field will just be resolved as a string template, and the resulting string used as a default value.
    • When the type is Payload Path, the value in this field will be treated as a payload path, and whatever exists at that payload path will be used as the default value.
    • When the type is JSON Template, the value in this field will be templated and then parsed as a JSON object, and that will be used as the default value.
  • Result Path: This is the payload path at which the workflow will place the retrival result. This will either be the value actually retrived from workflow storage, or the resolved default value if requested key did not exist.

Node Example

In the above “Fetch a single stored value” example, the workflow will fetch the value stored under the identifier storedColor, and will place that value in the current payload at the path data.color. If there is no value stored under storedColor, the workflow will place 0 in data.color instead.

So, in the case that the value 12562 was stored under the storedColor identifier and the workflow was executed with the following payload:

{
  "time": Fri Feb 19 2016 17:26:00 GMT-0500 (EST),
  "data": { },
  "applicationId": "568beedeb436ab01007be53d",
  "applicationName": "Light Wall",
  "triggerId": "56c794a06895b00100cbe84c",
  "triggerType": "deviceId",
  "deviceTags": { },
  "deviceName": "Ranger",
  "globals": { },
  "flowId": "56c794a06895b00100cbe84c",
  "flowName": "Range To Color"
}

The payload after the execution of the Storage: Get Value Node would look like:

{
  "time": Fri Feb 19 2016 17:26:00 GMT-0500 (EST),
  "data": {
    "color": 12562
  },
  "applicationId": "568beedeb436ab01007be53d",
  "applicationName": "Light Wall",
  "triggerId": "56c794a06895b00100cbe84c",
  "triggerType": "deviceId",
  "deviceTags": { },
  "deviceName": "Ranger",
  "globals": { },
  "flowId": "56c794a06895b00100cbe84c",
  "flowName": "Range To Color"
}

Node Errors

There are a few possible errors that can occur with this node.

  • Missing Key: This can occur if the Key field is a string template that resolves to a blank string. Blank strings are not valid workflow storage keys, and so the workflow will throw this error.
  • Default Value template did not render to valid JSON: This can occur if the default value type is JSON Template, but the value in the default value field does not actually template to a valid json string.