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.
Node Properties
There are two different ways to use this node: fetching a particular storage value for a workflow, or fetching all storage values for a workflow.
Fetch All Currently Stored Values
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 retrieval 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.
For Edge Workflows, the ability to fetch all storage values is only available in Gateway Edge Agent Version 1.10.0 and higher.
Fetch a Single Stored Value
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 arePayload Path
,String Template
, andJSON 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 theKey
when it is not found.- When
Default Value Type
isString Template
, the value in this field renders as a string template against your payload, and the resulting string is used as the 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.
- When
- Result Path: This is the payload path at which the workflow will place the retrieval result. This will either be the value actually retrieved 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 2021 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 2021 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.
Related Nodes
Was this page helpful?
Still looking for help? You can also search the WEGnology Forums or submit your question there.