# Data Read Global

This function block allows you to read data from a global storage that is accessible across different scenarios, facilitating loops and data sharing. Please note that data integrity is not guaranteed.

## 📥 Inputs <a href="#inputs" id="inputs"></a>

This function block does not require any inputs.

## 📤 Outputs <a href="#outputs" id="outputs"></a>

`Data` The output provides the value associated with the specified key from the global data storage. If the key is not found, it returns -1.

## 🕹️ Controls <a href="#controls" id="controls"></a>

`Data Key` A text box where you enter the key of the data you want to read from the global storage.

## 🎨 Features <a href="#features" id="features"></a>

`Global Data Access` This block gives access to data that is stored globally, allowing for easy retrieval and sharing of information between different parts of your application.

`Warning for Missing Keys` If the specified key is not found in the global storage, the function block logs a warning to help you troubleshoot.

## 📝 Usage Instructions <a href="#usage" id="usage"></a>

1. **Specify Data Key**: Enter the desired key into the `Data Key` text box to indicate which data should be retrieved.
2. **Run the Block**: Execute the block to read from the global data storage. The value associated with the provided key will be output.

## 📊 Evaluation <a href="#evaluation" id="evaluation"></a>

When evaluated, this function block attempts to retrieve the data associated with the specified key in the global storage. If successful, it outputs the data; otherwise, it returns -1.

## 💡 Tips and Tricks <a href="#tips-and-tricks" id="tips-and-tricks"></a>

<details>

<summary>Ensure Key Exists</summary>

Before attempting to read from global storage, you may want to verify that the key exists. You can use the `Data Store Write Global` to input the key and value first.

</details>

<details>

<summary>Check Data Types</summary>

Make sure that the data stored under the key matches the expected type in your workflow. Mismatches can lead to unexpected behavior in function blocks that process the data.

</details>

## 🛠️ Troubleshooting <a href="#troubleshooting" id="troubleshooting"></a>

<details>

<summary>Key Not Found Warning</summary>

If you receive a warning saying the key could not be found, double-check the spelling of the key entered and ensure that it was previously stored in the global data storage.

</details>

<details>

<summary>Unexpected Output</summary>

If the output is consistently -1, it indicates that the key does not exist. Consider using the `Data Store Write Global` function block to add the key to storage before reading.

</details>
