Skip to content

Feature request: let MDL position microflow/nanoflow parameters (MicroflowParameter has coordinates, but no annotation reaches it) #993

Description

@TDSC0706

Use case

We lint the canvas of every microflow and nanoflow we generate, and one of our house rules
is where the parameters sit: above the start event, in a two-column grid filled row by
row from the bottom up, in parameter order.

        p4   p3        row 2        col0.cx = start.cx
        p2   p1        row 1        col1.cx = start.cx − 100
             o         start        row k.cy = start.cy − (100 + (k−1)·100)

Parameters are stored nodes with real geometry — every MicroflowParameter in our project
is 30×30 with its own RelativeMiddlePoint (263 of 263 measured) — and Studio Pro lets
you drag them. But no MDL annotation reaches them, so a generated flow's parameter block
lands wherever the writer puts it and stays there.

The rest of the canvas is already scriptable: @position on statements, @anchor and
@curve on edges, @start on the start event (new in 0.20.0), @merge on an end-if.
Parameters are the one remaining node family with coordinates and no way to set them —
which means a flow that is otherwise byte-identical to a hand-aligned reference still
needs a manual pass for the parameter block alone.

This is the same argument as @start: the start event also had coordinates and no
annotation, and #951 closed that gap. Parameters are the sibling case.

Proposed syntax or behavior

The annotation form the grammar already uses, applied to a parameter declaration:

CREATE NANOFLOW MyFirstModule.NF_ParamPos (
  @position(300, 100)
  $A: Integer
)
RETURNS Integer AS $R
BEGIN
  @position(300, 200)
  DECLARE $R Integer = $A + 1;
  @position(500, 200)
  RETURN $R;
END;
/

Today this is a parse error — verified on a blank project
(mx create-project --app-name ReproApp, Mendix 11.12.1), identical on v0.19.0 and v0.20.0:

line 2:2  extraneous input '@' expecting the start of a statement (create, alter, drop, show, describe, …)
line 2:11 mismatched input '(' expecting ':'
line 2:17 mismatched input '100' expecting the start of a statement (…)

For reference, the same blank project shows the node does carry geometry: writing the
nanoflow without the annotation stores its MicroflowParameter at RelativeMiddlePoint 200;53, Size 30;30 — a real position, just not one a script can choose.

Failing loudly is the right behaviour for something unsupported — no complaint there; this
is a request for the capability, not a bug report about the error.

An alternative that avoids touching the parameter list grammar would be a single
block-level annotation before BEGIN, e.g.:

@parameters((300, 100), (200, 100))
BEGIN

but the per-parameter form reads better and matches how @position already attaches to
the thing it positions.

describe should emit it too. Today describe microflow / describe nanoflow emit no
parameter geometry at all, so even a hand-aligned flow round-trips with its parameter block
reset — the same silent-loss shape as the mapping round-trips closed in 0.20.0.

Mendix version relevance

Not version-specific as far as we can tell. Measured on Mendix 11.12.1 (MPR v2);
MicroflowParameter carries RelativeMiddlePoint + Size the same way an activity does.

Why it matters more for nanoflows

Studio Pro's PED API (ped_update_document) can patch a microflow's node coordinates,
so for microflows this is a convenience. It does not write nanoflows — so for a
nanoflow, MDL is the only writer, and parameter placement is simply out of reach from any
script.

Environment

mxcli version v0.19.0 (2026-08-21T13:13:26Z)   -- PATH binary
mxcli version v0.20.0 (2026-08-28T13:22:53Z)   -- current release, same result
Mendix Studio Pro 11.12.1, MPR v2, 1971 units

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions