dash

dash, keyword

The dash keyword marks assignments evaluated during the interactive phase. Dash variables exist only in the browser, and are recomputed when the user changes inputs.

Example

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

table T[id] = with
  [| as id, as Min, as Max |]
  [| "A", 1, 5 |]
  [| "B", 0, 10 |]

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

dash T.IsValid = T.Min <= T.Value and T.Value <= T.Max
dash T.Color = if T.IsValid then "default" else "red"

show table "Values" editable: "values" with
  T.id { columnReadOnly: true }
  mutable T.Value { cellBackground: #[T.Color] }
  T.Min { columnReadOnly: true }
  T.Max { columnReadOnly: true }

Remarks

Dash expressions can use number, boolean, text, date, week, month, markdown, any enum, and tuples of those types. They support comparisons, arithmetic, boolean logic, if then else, match, interpolation, broadcasting, and pure functions marked as dash.

Dash variables are rejected in non-dash contexts such as write, where, and non-dash assignments, except for system-defined tiny tables.

User Contributed Notes
0 notes + add a note