Skip to content

Reference Dynamic Outputs

madscatt edited this page Jun 21, 2026 · 6 revisions

Dynamic Outputs

Dynamic outputs let an html5 module declare one output group and create a bounded set of output instances at runtime. This is for executables that do not know the exact number of reports or plots until the job runs.

The first supported dynamic output types are html and plotly.

Module JSON

Declare a normal output field and add:

  • dynamicoutput: set to true
  • idprefix: required prefix for generated instance ids
  • max: required positive integer cap on generated instances

Example:

{
    "role"          : "output",
    "id"            : "dynamic_plot",
    "label"         : "Dynamic Plot",
    "type"          : "plotly",
    "dynamicoutput" : "true",
    "idprefix"      : "dyn_plot",
    "max"           : "4"
}

Executable Output

Return an object or array under the declared dynamic group id. Each item may include:

  • label: label shown next to the generated instance
  • value or data: value passed to the underlying output renderer
  • id: optional explicit instance id; it must be a safe GenApp-style id

Example:

{
    "dynamic_plot": {
        "items": [
            {
                "label": "Residuals",
                "value": {
                    "data": [
                        { "x": [1, 2, 3], "y": [2, 1, 2], "type": "scatter" }
                    ],
                    "layout": { "title": "Residuals" }
                }
            },
            {
                "id": "dyn_plot_summary",
                "label": "Summary",
                "value": {
                    "data": [
                        { "x": ["ok", "warn"], "y": [8, 1], "type": "bar" }
                    ]
                }
            }
        ]
    }
}

By default, a new dynamic update replaces previously generated instances for that group. Use "replace": false in the group object when a partial update should leave existing instances in place.

Constraints

  • Dynamic outputs are html5-only.
  • The field must have role: output.
  • The first implementation supports type: html and type: plotly.
  • max is required and limits the number of items rendered.
  • idprefix is required and must be a valid safe identifier.
  • If an item omits id, GenApp generates ids as idprefix_1, idprefix_2, and so on.

Runtime Behavior

GenApp generates only the dynamic group container statically. Runtime data creates child output fields inside that group, then routes each child value through the existing output renderer for the declared type.

Resetting the module output removes generated dynamic instances and clears their saved last/default value state.

Clone this wiki locally