GridscriptDonate

Input Stage

The Input stage lets you define simple typed parameters for a pipeline. It collects key/value pairs, converts them to the chosen type, and exposes them under context.input for later stages (such as code, filter, or transform) to use.

What the stage does

  • Key/value inputs — Each row defines a parameter name (key) and a raw value string.
  • Type parsing — Each input has a Type:
    • number: parsed via numeric conversion (integers/floats).
    • string: stored as a string value.
    • date: parsed into a Date from common formats (ISO, DD/MM/YYYY, MM/DD/YYYY).
    • any: parsed using JSON.parse (for objects/arrays/booleans/null), throwing on invalid JSON.
  • Context output — On execute, the stage writes context.input as an object:{ [key]: parsedValue }. Existing values at context.input are replaced on each run.
  • Logging — Logs how many inputs were added; errors are surfaced if parsing fails (for example, invalid JSON for type any).

Configure the Input stage

  1. Add an Input stage to your pipeline (typically near the top).
  2. Click New Input to add a parameter row.
  3. For each row:
    • Set Key — the name under context.input.key.
    • Enter Value as text.
    • Choose Type (number, string, date, any).
  4. Optionally remove rows with the x button.
  5. Run the stage (or Run All). The pipeline context now includescontext.input with parsed values ready for downstream stages.

Example: parameters for a code stage

  • Input 1 — Key: threshold, Value: 100, Type: number
  • Input 2 — Key: startDate, Value: 2025-01-01, Type: date
  • Input 3 — Key: filters, Value: [{"field":"status","value":"active"}], Type: any

After running the stage, a code stage can read context.input.threshold, context.input.startDate, and context.input.filters directly with the correct types.

Tips for reliable parameters

  • Prefer JSON for complex values: Use type any and valid JSON (arrays/objects) when you need richer structures.
  • Keep keys stable: Treat keys as part of your pipeline API so code stages can rely on them.
  • Validate downstream: Combine with Validate or code stages to enforce constraints on parameter values.