Skip to main content

Expression Notations Overview

Powersheet uses two distinct expression notations depending on the configuration file type:
If you are editing a data model YAML file (domainModelTypes, relationships), use $context. If you are editing a sheet configuration YAML file (sources, columns, formatters), use () =>.
diagram

Context Expression ($context)

Context expressions use dot-notation to access properties from the runtime context object. They are used exclusively in data model configuration — specifically in constraint definitions. No JavaScript logic is supported; only direct property path access.

Where $context Is Used

Available Context Paths

Dynamic constraints with $context are evaluated per-row. Different rows can produce different constraint values depending on their source entity’s properties.

$context Examples

Filter linked items to the same document component as the source item:
When viewing a SystemRequirement from the “Braking” component, only DesignRequirement items from “Braking” documents are loaded. Filter linked items to the same document as the source item:
Filter by source entity’s document type (pick constraint):

Dynamic Value (() => expression)

Dynamic values use JavaScript arrow function syntax and are used in sheet configuration YAML. They provide full JavaScript expressiveness for computing values, filtering data, and rendering content at runtime.

How It Works

A () => expression is a JavaScript arrow function that receives a context object. Powersheet evaluates the function at runtime and uses the returned value. The expression must be enclosed in quotes in the YAML configuration.

Where () => Is Used

formula affects persisted data — the calculated value is saved back to the data source. Use render if you only need to change how a value is displayed without modifying the underlying data.
Formatter expressions use a simplified syntax — they do not start with () =>. The expression is evaluated as a boolean condition directly (e.g., "context.item.Risk > 50").

The Context Object

The context object provides runtime information to dynamic expressions. Its structure is hierarchical, and properties are progressively available depending on the evaluation scope.

Context Availability by Location

Not all context properties are available in every expression location. The following table shows which properties are accessible where:

Context Properties Reference


Expression Examples by Use Case

Source Query Filtering (where)

Filter to items in the current document module:
This restricts the source query to work items that belong to the same LiveDoc module as the document the sheet is embedded in. Filter by today’s date (future items only):
The resulting value must be in the correct format for the data type. For date fields, always use .toISOString() to produce the expected ISO 8601 string.

Entity Factory (Default Values for New Items)

Derive default values from the parent (source) entity:
In nested or relationship-driven contexts, entityFactory uses context.source to access properties of the parent entity that triggered the row creation. Static values (like status: Draft above) and dynamic expressions can be mixed freely in the same entityFactory block.

Column Formula (Calculated Values)

Calculate a value from other entity properties:
Concatenate string properties:

Column Render (Display-Only HTML)

Bold rendering of a cell value:

Named Renderers

Render a collection of linked items as a comma-separated list:
Reference the renderer by name from a column:

Column Display (Navigation Property Override)

The display property overrides what users see for a navigation column without changing the underlying data binding. It is the most common location for short, focused () => expressions. Show the linked entity’s title or fall back to its name:
titleOrName is a convenient idiom for entities that may have either a title (work items with rich descriptions) or only a name (lightweight reference entities). Show only the title of the linked entity:
Show the linked entity’s parent document title instead of the entity itself:
Compose a display string from multiple properties of the linked entity:
This pattern is useful when a column shows a single linked item but you want a richer label (for example, an ID prefix followed by a human-readable title).

Conditional Formatting (Formatters)

Highlight rows where probability is below a threshold:
Formatter expressions do not use the () => prefix. They are evaluated directly as boolean conditions. The formatter references a style definition.

Complete YAML Example

A full sheet configuration demonstrating multiple dynamic expression patterns:

Quick Reference


Common Patterns and Edge Cases

Combining Static and Dynamic Values

In entityFactory, static and dynamic values coexist. Only values with the () => prefix are evaluated at runtime:

Multiple $context Constraints

You can combine multiple $context paths in a single constraint block to narrow the filter:

Display Variants for the Same Navigation Column

A single navigation column can render very differently depending on the display expression. The same binding systemRequirements.systemRequirement can show:
Use display whenever you need to change only how a linked entity appears in a cell, without changing the underlying binding path or affecting other views.

Date Handling

Date comparisons require ISO 8601 format. Always call .toISOString() on Date objects:
The example above filters for items created within the last 7 days.

Nested Navigation in Render Expressions

When rendering values from expanded entities, context.value contains the resolved data. For collections, use .map() and .join():

  • Binding Syntax — column key path structure and navigation patterns
  • Columns — full column property reference including formula, render, and display
  • Formatters — conditional formatting configuration and style references
  • Styles — style definitions used by formatters and column headers
  • Sources — data source configuration including query.where and entityFactory
  • Render Property — detailed reference for custom rendering
  • Display Property — display override for navigation property columns
  • Constraints — constraint configuration where $context expressions are used
  • Context Expressions Reference — extended reference on $context paths in data models
Last modified on July 10, 2026