Get variable
Last updated
Last updated
The Get Variable block allows us to retrieve the value of a previously stored variable within the graph's data context.
The Get Variable block allows us to retrieve the value of a previously stored variable within the graph's data context that had previously been declared and assigned to by Set variable
block.
In the example below, we use the Get Variable block to retrieve the previously stored value of "priceThreshold" and use it as an input for the Check Price block:
When the above graph is executed, the Get Variable block fetches the value of "priceThreshold," which was previously stored in the data context, and passes it as input to the Check Price block for price comparison. This enables us to use data that has been calculated or determined earlier in the graph, allowing for efficient and structured data flow.
Get variable
blocks have one input: a string for the name of the variable we are accessing. They also have one output, which is the value of the variable we have accessed.
The purpose of Get Variable
and Set variable
blocks is to be able to store data in variables that can be accessed and modified later on in a graph's execution
If no variable exists with the name that we pass to a Get variable
block, then it will simply output no data, and any block receiving as input the Get Variable
block's output will instead receive empty (or null) data.
Refer to the Set variable
block page for examples of Get variable
and Set variable
blocks in action.