Portal Community

Dynamic Path Expression

Prefix the path with expr: to signal that it is an expression, not a literal path. The expression is evaluated using the form's current value map:

// Static path (always binds to items[0].price):
"binding": { "source": "$json", "path": "items[0].price" }

// Dynamic path (binds to items[n].price where n comes from another field):
"binding": {
  "source": "$json",
  "path":   "expr:items[values['selected-index']].price"
}

Example — Item Detail Form

A user selects a line item from a grid, then edits its details in a separate panel. The detail fields dynamically bind to the selected item's index:

// Form schema (abridged)
{
  "controls": [
    // Hidden field — populated programmatically when user clicks a row
    {
      "id":   "selected-index",
      "type": "hidden",
      "binding": { "source": "$json", "path": "selectedIndex" }
    },

    // Detail fields — paths depend on selected-index
    {
      "id":    "item-name",
      "type":  "text",
      "label": "Item Name",
      "binding": {
        "source": "$json",
        "path":   "expr:items[values['selected-index']].name"
      }
    },
    {
      "id":    "item-price",
      "type":  "number",
      "label": "Unit Price",
      "binding": {
        "source": "$json",
        "path":   "expr:items[values['selected-index']].price"
      }
    }
  ]
}

// When the user selects row 2:
engine.setValue('selected-index', 2);
// item-name now reads from items[2].name
// item-price now reads from items[2].price

Expression Evaluation Rules

When Not to Use Dynamic Binding

ScenarioBetter Approach
The path is always staticUse a plain path string — simpler and faster
You need to show an array of itemsUse a repeater control — designed for this use case
The path depends on a server-side valueCompute the path server-side and pass as a static schema string at load time
Dynamic Binding Has Performance Overhead Every change to the value map triggers re-evaluation of all dynamic path expressions. For forms with many dynamic bindings, this can cause extra re-render cycles. Prefer static paths where possible, and use dynamic binding only when the path genuinely cannot be known at schema authoring time.