Expression Notations Overview
Powersheet uses two distinct expression notations depending on the configuration file type: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:
SystemRequirement from the “Braking” component, only DesignRequirement items from “Braking” documents are loaded.
Filter linked items to the same document as the source item:
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
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:
Entity Factory (Default Values for New Items)
Derive default values from the parent (source) entity: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:Column Render (Display-Only HTML)
Bold rendering of a cell value:Named Renderers
Render a collection of linked items as a comma-separated list:Column Display (Navigation Property Override)
Thedisplay 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:
Conditional Formatting (Formatters)
Highlight rows where probability is below a threshold:() => 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
InentityFactory, 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 thedisplay expression. The same binding systemRequirements.systemRequirement can show:
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:
Nested Navigation in Render Expressions
When rendering values from expanded entities,context.value contains the resolved data. For collections, use .map() and .join():
Related Pages
- Binding Syntax — column key path structure and navigation patterns
- Columns — full column property reference including
formula,render, anddisplay - Formatters — conditional formatting configuration and style references
- Styles — style definitions used by formatters and column headers
- Sources — data source configuration including
query.whereandentityFactory - Render Property — detailed reference for custom rendering
- Display Property — display override for navigation property columns
- Constraints — constraint configuration where
$contextexpressions are used - Context Expressions Reference — extended reference on
$contextpaths in data models