Grooper Help - Version 25.0
25.0.0032 2,215

Next Step Expression

Grooper.Core

Defines a dynamic routing expression for determining the next Batch Process Step in a Batch Process workflow.

Remarks

The Next Step Expression Builder enables advanced, user-configurable logic for routing batches through a Batch Process.
It uses a code expression—written in Visual Basic—that determines which Batch Process Step should execute next, based on batch data, step results, or custom business rules.

This expression type is used by the 'Next Step Expression' property on Batch Process Step objects. When a batch completes a step, the expression is evaluated to select the next step, enabling dynamic branching, exception handling, and custom workflow scenarios.

How It Works

  • For each Batch Process Step with a 'Next Step Expression', a dynamic class is generated and compiled at runtime.
  • The generated class inherits from RoutingExpression, which exposes the current step, the parent Batch Process, and the current index data (if available).
  • The expression can reference any step in the process, batch-level data, or document index fields, allowing for highly flexible routing logic.
  • When the batch reaches the step, the compiled expression is executed to determine the next step. Returning Nothing completes the batch.

Expression Environment

Data Exposure in the Expression

If the Batch Process has its 'Content Type' property set, the data model for that type is exposed in the expression environment through a strongly-typed Data property.
This property provides access to all Data Elements defined in the Data Model, including fields, sections, tables, and any inherited or related data via 'Child Of' and 'Sibling Of' relationships.
The Data property is an instance of a dynamically generated class (see Data Model Compiler) that mirrors the structure of the Data Model and provides strongly-typed access to all data elements and their values.

For example, you can reference data fields directly in your expression:

If(Data.Invoice_Number = "" And Data.Total = 0, Export, Data_Review)

This enables routing decisions based on extracted or validated document data.

For more information about what is exposed in the Data property, see Next Step Expression and Data Model Compiler.

Usage Scenarios

  • Conditional Routing:
    Route batches to different steps based on data values, error conditions, or custom flags.
  • Exception Handling:
    Send batches to review or exception queues when validation fails or errors are detected.
  • Workflow Branching:
    Implement complex, multi-path workflows that adapt to batch content or processing results.

Best Practices

  • Use clear, maintainable expressions for routing logic.
    Reference steps and data fields by name for readability.
  • Test expressions thoroughly to ensure correct routing in all scenarios.
  • Avoid circular routing logic that could cause infinite loops.

Related Features

  • Batch Process Step: The workflow step where routing expressions are configured.
  • Batch Process: The parent workflow containing all steps and routing logic.
  • Data Model Compiler: Details the structure and capabilities of the Data property exposed in the expression environment.

Notification