Get Batch Size

This function block returns the number of elements in a provided batch or list. It is useful for flow control, logging, and branching decisions when working with grouped data.

πŸ“₯ Inputs

  • Batch This input accepts a batch/list of items to measure.

    • Socket: Input

πŸ“€ Outputs

  • Size Numeric value representing the count of elements in the provided batch.

    • Socket: Output

πŸ•ΉοΈ Controls

  • No Controls This function block does not expose any interactive widgets.

βš™οΈ Running mechanism

When this block receives a batch on its input socket it evaluates the collection and outputs the current number of elements on the Size output. Evaluate this block downstream of any process that creates or combines batches to get an immediate numeric count for decision making or logging.

Use helper blocks (see Tips and Tricks) to validate or adjust the batch before feeding it in, so the size measurement is reliable even when upstream data is missing or dynamic.

🎯 Features

  • Simple, single-purpose block that provides an immediate numeric size for any batch/list input.

  • Works as a lightweight flow-control tool to trigger conditional logic based on batch length.

  • Compatible with generic batch-producing blocks in the flow control and data processing categories.

πŸ“ Usage

  • Place this block after any block that outputs a list/batch to obtain the number of items being passed along.

  • Feed the Size output into comparison or logic blocks (for example, Greater, Equals, Logic Input) to branch the scenario based on batch count.

  • Combine with logging or export blocks to record how many items were processed in each run.

πŸ’‘ Tips and Tricks

  • Use with Batch Processing when you are creating batches for memory-efficient processing; connect its batch output to Batch here to monitor batch sizes.

  • After splitting a batch with Debatch, reconnect pieces and use this block to verify the size of reassembled lists.

  • Combine with Get Element to check a batch length before trying to access an index; this prevents out-of-range access.

  • When merging multiple batches, use Batch Concatenation first, then this block to confirm the resulting size.

  • If the upstream source may provide no data, pair this block with Is None or Replace None to ensure stable behavior and avoid unexpected errors.

πŸ› οΈ Troubleshooting

  • If the block reports unexpected sizes, verify that the input is indeed a list/batch type (use debugging or Debug Input to inspect content).

  • If the input may be absent, add validation using Is None or Replace None so the size measurement remains predictable.

Last updated

Was this helpful?