form

form, tile type

The form tile is intended to display a form where values can be manually entered from the dashboard view. The variables listed for display in this tile are expected to be attached scalar values obtained from a read form.

read form with
  StartDate : date
  IsTicked : boolean
  Category : text
  MyHidden : text

show form "My settings" with
  StartDate as "My start date"
  IsTicked as "Is ticked"
  Category as "My category"
  MyHidden { formAccess: hidden }

show summary "My settings view" with
  StartDate
  IsTicked
  Category
  MyHidden

Form values come from dashboard submissions. Runs from the IDE or RunFlow replay the last submission unless overridden there. The last submission is not a programmatic state.

Form values are scalars and persist across runs. Newly introduced form fields default to the type default (for example 0 for number).

The form namespace can be used to access raw values, but it is not a table.

read form with
  n : number

k = n + 1

show scalar "My counter" with k

Binding form values

show form can display arbitrary scalar expressions as long as they are bound to a form field via form:"name".

read form with
  n : number

k = n + 1

show form "Click 'Start run' to increase this counter" with 
  k form:"n"

Compile-time access

Form values are available at compile time and can be used to build paths in read statements.

read form with
  folder : text

read "/\{folder}/orders.tsv" as T max 1m with
  Quantity : number

show scalar "Total" with sum(T.Quantity)

Specifying a default form values is possible.

read form with
  StartDate : date
  IsTicked : boolean
  Category : text
  MyHidden : text

show form "My settings" with
  date(2022, 2, 17) as "My start date" form: "StartDate" 
  false as "Is ticked" form: "IsTicked"
  "my default category" as "My category" form: "Category"
  "my hidden default" form: "MyHidden" { formAccess: hidden }

show summary "My settings view" with
  StartDate
  IsTicked
  Category
  MyHidden

Roadmap: There are two syntaxes that co-exist for the tile form. The former does not allow the default values to be set. The later uses text literals to identifies variables. Neither of the two syntaxes for the form tile is really satisfying. This syntax will be refactored in the future.

StyleCode

For generic StyleCode rules, see stylecode.

User Contributed Notes
0 notes + add a note