Skip to main content

Get Global Node

Get Global Node Screenshot

Overview

The Get Global Node is used to retrieve a global value that is shared across all graphs and subgraphs. The ID of the global value is configured in this node.

The node can be configured to retrieve the value on demand, which means it will be read when nodes need it, rather than when this node executes. This is useful when the global value might change during the execution of the graph.

The node can also be configured to wait until the variable is available. This is useful when the global value is set by another node that might not have completed its execution when this node runs.

Inputs

TitleData TypeDescriptionDefault ValueNotes
Variable IDstringThe ID of the global variable to retrieve. This input is only available if the "Use Input" toggle is checked.N/AThe input will be coerced into a string if it is not a string.

Example 1: Retrieve a global variable

  1. Add a Set Global Node to the graph. Set the variable name to myGlobalVariable and the value to Hello World using a Text Node.
  2. In a separate part of the graph, add a Delay Node and set the delay to 1000 (1 second).
  3. Create a Text Node and set the text to myGlobalVariable. Pass the text into the Delay Node.
  4. Create a Get Global Node, enable the input for "Variable Name", and pass the output of the Delay Node into the input. Disable the "On Demand" setting.

Get Global Node Example 1

Example 2: Retrieve a global variable on-demand

  1. Add a Set Global Node to the graph. Set the variable name to myGlobalVariable and the value to Hello World using a Text Node.
  2. Add a Get Global Node and set the variable name to myGlobalVariable. Enable the "On Demand" setting.
  3. Add an If Node. Set the If input to the Set Global Node, and set the Value input to the Get Global Node. This will wait for both nodes to complete before running, and will pass the Get Global Node's value through to the next node.
  4. Add a Text Node and connect the If Node to the Text Node.
  5. Run the graph. Notice that the value of the If node is Function<string> because the "On-Demand" setting has been enabled, causing the value to not have resolved yet. The value is resolved in the Text Node, and "Hello World" is displayed.

Get Global Node Example 2

Error Handling

The Get Global Node will error if the global variable is not found and the Wait setting is disabled. If the Wait setting is enabled, the node will wait until the variable is available.

FAQ

Q: What is a global variable?

A: A global variable is a value that is shared across all graphs and subgraphs. It is set using a Set Global Node and retrieved using a Get Global Node.

Q: Can I set a global variable from a parent application?

A: No, global variables can only be set from within the graph. Use a Context Node instead to access global variables set by the parent application.

Q: What happens if the global variable is not found?

A: If the global variable is not found and the Wait setting is disabled, the Get Global Node will return the default value for the data type selected. For example, if the data type is set to string, the default value will be an empty string. If the Wait setting is enabled, the node will wait until the variable is available before returning the value.

See Also