Skip to main content

Expression Notations Overview

Powersheet uses two distinct expression notations depending on the configuration file type:
Rule of ThumbIf 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

Per-Row EvaluationDynamic 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

value is about data; render and display are about appearance.On a column bound to a real property, value affects persisted data — the computed result is saved back to that property. Use render if you only need to change how a value is displayed without modifying the underlying data. If the result should never be stored at all, prefix the binding key with $ to make the column unbound.
formula is deprecated. Use value.Both names mean exactly the same thing, and existing configurations keep working unchanged, but formula is deprecated. Write value in new configurations. Declaring both on one column is rejected. See Computed Columns.
Formatter ExceptionFormatter expressions use a simplified syntax — they do not start with () =>. The expression is evaluated as a boolean condition directly (e.g., "context.entity.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.item is deprecated because it’s ambiguous — in some cell expressions it’s the entity, in others the whole row. Use context.entity or context.row instead; each always means exactly one thing.
A computed column starts from no cell value.context.value is undefined inside a value expression, whether the column is bound or unbound, because the cell has nothing stored yet. Read what you need from context.entity instead.Only an unbound column’s value expression receives context.row and context.source. A bound value column is evaluated as a calculated property of the entity alone, with no row behind it.

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):
Date FormattingThe 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 Value (Computed Columns)

Compute a value from other entity properties and store it in the bound property:
A computed column is read-only by definition — its content comes from the expression, so there is no need to declare isReadOnly. Concatenate string properties:
Compute a value that is displayed but never stored: Prefix the binding key with $ to make the column unbound. It has no property behind it, so declare the result type with valueType:
Reach the level above, or the whole row, from an unbound column:
See Add a Computed Column for the full walkthrough and Computed Columns for the property reference.

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, navigation patterns, and the $ unbound marker
  • Columns — full column property reference including value, valueType, render, and display
  • Add a Computed Column — step-by-step guide to stored and display-only computed columns
  • 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 August 31, 2026