Skip to content

Expressions

Expressions allow access to data and variables. Most properties, including enumerations like HorizontalAlignment, support expressions.

An expression is a string enclosed in curly braces: "{expression}".

Expression syntax

Data Sources

Expressions can retrieve data from the following sources:

Accessing Data

The full list of available root data objects and their mapping to API classes is described in Data Objects.

Access properties using the full path:

{Session.DriverDayDriver.Name}

If the expression does not contain a dot, the application searches for a variable with that name.

Collection Context

For inner blocks within collections (e.g., ItemStack, Table), the following root objects are available:

  • Item: Access to the current item in the collection.
  • ItemIndex: Index of the current item (integer, starts at 0).
  • ColumnIndex: Index of the current column (integer, starts at 0, only for tables).
  • ParentItem: Access to the parent item element when using nested iterations.
  • ParentItemIndex: Index of the parent item in its parent collection.

Parent Scope

When using nested iterations (for example, an ItemStack inside another ItemStack), the inner iteration gains access to the data of the outer iteration via the ParentItem root object.

  • {ParentItem} — The parent data object itself.
  • {ParentItem.PropertyName} — Resolves a property on the parent object.
  • {ParentItemIndex} — The index of the parent item.

Note: Only one level of parent scope is currently supported ({ParentItem.ParentItem} is NOT supported).

Examples for ParentItem

1. Colorizing inner items by parent team color

In a DriverSeasonStatistics view, if you are iterating through tyre stints (Stints), you can use the driver's team color for the stint background:

{
  "Type": "ItemStack",
  "ItemSource": "{Item.Stints}",
  "ItemTemplate": {
    "Type": "Rectangle",
    "Width": 50,
    "Height": 30,
    "Background": "{ParentItem.Team.Color}",
    "Items": [
      {
        "Type": "Text",
        "Content": "{Item.Laps}",
        "FontSize": 10,
        "Foreground": "White"
      }
    ]
  }
}

2. Accessing Driver Name in nested sessions

Iterating through drivers and then through their sessions:

{
  "Type": "Table",
  "ItemSource": "{Drivers}",
  "ItemTemplate": {
    "Type": "ItemStack",
    "ItemSource": "{Item.Sessions}",
    "ItemTemplate": {
      "Type": "Panel",
      "Items": [
        {
          "Type": "Text",
          "Content": "{ParentItem.Driver.Name} - Session {Item.SessionType}",
          "Foreground": "{ParentItem.Team.Color}"
        }
      ]
    }
  }
}

3. Conditional Rendering based on parent property

Rendering a block only if the parent's team is known:

{
  "Type": "ItemStack",
  "ItemSource": "{Item.Stints}",
  "ItemTemplate": {
    "Type": "Panel",
    "RenderIf": "{ParentItem.Team.Name != 'Unknown'}",
    "Items": [
      {
        "Type": "Text",
        "Content": "{Item.Percentage}% on {Item.Tyres}"
      }
    ]
  }
}

Example expression:

Expression example

Return Values

Depending on the context, an expression returns either an object (e.g., bool, number, color) or a string. If the context requires a string but the expression returns an object, the object is forced to a string.

If a block property requires a specific object type (e.g., PaddingLeft requires a number), only one expression can be used at the root.

Correct:

Correct usage

Incorrect:

Incorrect usage

If the property requires a string, expressions can be combined freely.

Combining Expressions

Expressions can be nested, and an expression can be used as a converter name or parameter. The nesting depth is unlimited. This also applies to localization string substitutions.

Nested expressions

For string properties, multiple expressions can be combined with literals in a single string:

Combined expressions

Escaping Special Symbols

To use special characters as literals instead of control characters, escape them using a double forward slash //.

Symbol Escape Sequence Context
{ //{ General
} //} General
[ //[ General
] //] General
< //< General
> //> General
= //= Inside expression
: //: Inside converter parameters
; //; Inside converter parameters

Example:

Escaping example

This expression converts to:

[driver_name]

Note: Forward slashes are used instead of backslashes to avoid issues with JSON parsers. Double slashes are used to prevent conflicts with URIs and file paths.