Replace None

This function block provides a simple fallback mechanism: when the primary input is missing (None), it outputs a user-provided replacement value so downstream blocks continue to receive valid data.

πŸ“₯ Inputs

  • Input Data (Generic) β€” Primary data to be checked for presence.

  • New Data (Generic) β€” Replacement data to use when the primary input is None.

πŸ“€ Outputs

  • Replaced Data (Generic) β€” The resulting data: either the original Input Data if present, or New Data when the input is None.

πŸ•ΉοΈ Controls

This block has no interactive controls.

🎯 Features

  • Minimal, reliable fallback for missing values to prevent breaks in a flow.

  • Generic data type support β€” works with images, numbers, text, lists, or other data types.

  • Lightweight and deterministic behavior β€” always passes either the original or the replacement value.

πŸ“ Usage Instructions

  1. Connect the source you want to guard to Input Data.

  2. Provide a default or fallback value to New Data. This can be a static value, a previously stored value, or a placeholder image/number/text.

  3. Read the result from Replaced Data and continue the pipeline as usual.

Example uses: provide a placeholder image when a camera feed briefly fails, supply a default number for calculations, or pass a backup string when a network response is missing.

βš™οΈ How it runs

When the flow runs, this block checks whether Input Data is present. If it is present, that value is forwarded. If it is None, the block forwards the value supplied to New Data. If both are None, the output will be None (so ensure a meaningful fallback is provided when needed).

πŸ’‘ Tips and Tricks

  • Combine with Is None to create branching logic (for example, trigger an alert only when the original input is missing).

  • Use with Data Memory to freeze and re-use the last valid value as the New Data fallback.

  • When dealing with image streams (e.g., from Camera USB or Stream Reader), feed a representative static image into New Data so viewers like Show Image always have something meaningful to display.

  • Pair with Debug Input or Data to JSON to log when fallbacks are used, helping you monitor data quality over time.

  • For saving fallback events or results, link Replaced Data to CSV Export or Image Logger depending on data type.

πŸ› οΈ Troubleshooting

  • If you still see None at the output, confirm a non-None value is provided to either Input Data or New Data.

  • For image pipelines: if the fallback appears but looks wrong, check the format (color channels, size) of the New Data to match downstream expectations.

Last updated

Was this helpful?