Browse documentation

Context variables

Define context variables on a canvas and bind widgets to them so one canvas can focus on different slices of data.

A canvas can define context variables: named filters that live on the canvas and, once bound to its widgets, let one canvas focus on different slices of data without rebuilding it. Set a value (say a counterparty or a date) and every bound widget re-filters to match. This is also how a task points a shared canvas at its own data. Context variables on a canvas work the way a workflow's do; see Workflow context variables.

What a context variable is

Each context variable has a name, a type, and one or more bindings to widget fields. The value set for a variable is applied as a filter on whichever widget field it's bound to, so the same variable can drive several widgets at once. A canvas can't be saved while a variable is bound to no widget: Save and close says Context variable "Customer" isn't linked and asks you to link it to at least one widget field.

A variable can also carry a default (its value before a viewer picks one) and a short list of options, offered to viewers as a dropdown. Canvases built by an agent or a workflow can set both, and SPARK keeps them when the canvas is saved.

Define context variables

Context variables are edited together with the widgets:

  1. Open the canvas's ⋯ and choose Edit canvas & context (or press ⌘E).
  2. In the second row of the edit bar, click Add context variable.
  3. Enter a Name (for example Customer), choose a Type, and click Confirm. The types are String, Number, Date, Boolean, Select, Multi-select, User, File, Relationship and Formula. Names must be unique; a duplicate shows This name is already taken.
  4. Variables appear as chips, the name in braces. A new variable starts picked, ready to bind. Drag a chip to reorder; the order is the order viewers' filter rows take. Use a chip's × to remove it.
{{Fund}}Add context variableNameTypeShare classSelectConfirm
Add a context variable: give it a name and a type, then Confirm.

Bind a variable to a widget

Binding is what makes a context variable actually filter something.

  1. Still in edit mode, click a variable's chip to pick it. Each widget card then shows, over its content, what it binds to that variable. The cards hold still while a variable is picked, so you can't move or open them by accident.
  2. On each widget that should follow the variable, click Select attribute and pick the field it fills; the picker lists only fields of the variable's type. The binding then reads as a filter, for example Customer > Name == {{ Customer }}. Binding a field on one widget binds the same field on the canvas's other widgets over the same data object; clear a binding with its ×.
  3. For a table widget, its relationship columns are listed under the binding too: bind one and the variable narrows that column's picker, so viewers editing a row only see matching records.
  4. Click the chip again, or Close context in the edit bar, to let the variable go.

A variable can bind to as many widgets as you like. Save and close saves the variables, their bindings and the widgets together; Discard changes drops them all.

{{Fund}}{{Share class}}NAV HistoryFund=={{Fund}}Share ClassesSelect attribute=={{Fund}}Add columnSearch attributes...FundShare ClassCurrency3 attributes
With a variable picked, bind each widget's field to it.

Set a context value

In view mode, the bar under the app header shows one filter row per context variable, starting with the variable's name. Pick a Condition (for a select variable: includes, not includes, empty or not empty), then a value, and every bound widget updates to that slice; clear or change it to refocus the canvas. A variable with options offers them as a dropdown (Pick one). A variable with a default starts on it.

Each bound widget's header shows a Filter pill: hover it to see which variables set its filters, and which were skipped for having no value.

The values you pick are yours: they live in your browser, survive a reload, and don't change the canvas for anyone else. Each canvas keeps its own picks, so a duplicate starts with none.

NAV by asset class1.5B1B500M0.001.3BEquity862MBonds645MMulti-asset210MCashFundincludesSelect...Share classConditionSearch optionsKestrel Global EquityKestrel Euro BondKestrel Multi-AssetKestrel Short Duration
In view mode, set each context value inline; bound widgets re-filter automatically.

Context variables elsewhere

  • A canvas shown in a Space or on a task shows its context filters above its widgets too, unless the task sets the values itself. See Attach a canvas.
  • A task raised by the Exception Framework sets the values itself: its canvas opens on the exception's share class, sub-fund and dates.
  • A PDF of the canvas prints with the values you picked, and names them on a line under each page's header. See Export a canvas to PDF.

Where to go next