mutable

mutable, keyword

The mutable keyword declares a dash-mutable variable or marks a writeable value inside an interactive tile. Mutable variables are initialized during the processing phase and can be edited by the dashboard viewer.

Example

read upload "values" as Submitted with
  Id : text
  Value : number

table T[id] = with
  [| as id, as Value |]
  [| "A", 1 |]
  [| "B", 2 |]

mutable T.Value = single(Submitted.Value) by Submitted.Id at T.id default 0

show table "Values" editable: "values" with
  T.id { columnReadOnly: true }
  T.Value mutable

Remarks

The initialization of a mutable variable is not a dash assignment. A mutable variable must be marked with mutable exactly once in a write context such as an editable show table. The marked expression must be the mutable variable itself. Expressions such as T.Value + 1 mutable and non-mutable variables cannot be marked with mutable. In an editable show table, a column marked with mutable must belong to the same table as the tile. Mutable variables are not broadcast into another table for editing. Other columns that display the same mutable variable without the mutable annotation are read-only aliases. They reflect edits made through the writeable column, but cannot receive edits themselves.

User Contributed Notes
0 notes + add a note