Skip to main content

Set Global Node

Set Global Node Screenshot

Overview

The Set Global Node is used to set a global value that is shared across all graphs and subgraphs during an execution in Rivet. This can be useful for storing and retrieving values that need to be accessed by multiple graphs.

The Set Global Node allows you to specify the ID of the global value and the value itself. The ID can be either a static string or an input value. The value can be of any data type.

Inputs

TitleData TypeDescriptionDefault ValueNotes
ValueAnyThe value to be set as the global value.(required)The input will be coerced into the data type specified in the node's settings.
Variable IDstringThe ID of the global value to be set. This input is only available if Use Variable ID Input is on.(optional)The input will be coerced into a string if it is not a string. The ID must be unique in the context.

Example 1: Set a global value

  1. Create a Text Node and set the value to Hello, World!.
  2. Create a Set Global Node and set the ID to greeting.
  3. Connect the Text Node to the Value input of the Set Global Node.
  4. Run the graph. The Value output of the Set Global Node should contain the value Hello, World!.

Set Global Node Example 1

Error Handling

The Set Global Node will error if the Value input is not provided or if the ID of the global value is not provided or not unique.

FAQ

Q: Can I set a global value to an array or an object?

A: Yes, you can set a global value to any data type, including arrays and objects. You can use an Array Node or an Object Node to create an array or an object, and then connect it to the Value input of the Set Global Node.

See Also