Try it free

Conditional rendering

  • Latest Dynatrace
  • Reference
  • 4-min read
  • Published Jul 13, 2026

Parts of a document can be shown or hidden at runtime based on the results of a DQL query — for example, showing a "Kubernetes" tab only for hosts that are Kubernetes nodes.

This page covers DqlConditionsContext, the Conditional mixin, and the Condition union (DqlVariableCondition, ExtensionConfiguredCondition), including the ConditionValue type used by variable conditions.

How it works

  1. The document declares a conditionContext at its root — one or more DQL queries to run once, up front.
  2. The query results are collected into named condition variables.
  3. Individual elements inside the document declare a conditions array; each condition tests a variable. An element only renders when all of its conditions are satisfied (AND semantics).

Condition variables are a separate channel from regular DQL query variables used elsewhere in the document (for example, table queries) — they exist only to drive visibility decisions.

DqlConditionsContext

Declared once, at the document root.

PropertyTypeDescription

query

string | string[]

One or more DQL queries whose result fields become condition variables.

resultFields

string[] (optional)

Field names to extract from the query result. When omitted, all result fields are extracted.

conditionContext: {
query: 'smartscapeNodes "HOST" | filter id == toSmartscapeId($(nodeId)) | fieldsAdd isK8s = isNotNull(fromRelationship.isNodeOf) | limit 1 | fields isK8s',
resultFields: ['isK8s'],
}

Conditional mixin

Any element type that supports conditions intersects with this mixin:

PropertyTypeDescription

conditions

Condition[] (optional)

If provided, the element renders only when every condition is satisfied.

Condition variants

Condition is a discriminated union on type.

DqlVariableCondition

Tests a condition variable produced by conditionContext against an expected value.

PropertyTypeDescription

type

'dql-variable'

Discriminant.

variable

string

Name of the condition variable to test.

value

ConditionValue | ConditionValue[]

Expected value. A single value means equality; an array means OR (matches if the variable equals any entry). ConditionValue is string | boolean.

{ "type": "dql-variable", "variable": "isK8s", "value": true }
{ "type": "dql-variable", "variable": "region", "value": ["eu", "us"] }

ExtensionConfiguredCondition

Tests whether the extension that shipped the document is installed and, optionally, meets version/feature-set/host-activation requirements.

PropertyTypeDescription

type

'extensionConfigured'

Discriminant.

aboveOrEqualVersion

string (optional)

Minimum extension version (semver).

belowOrEqualVersion

string (optional)

Maximum extension version (semver).

featureSets

string[] (optional)

Matches if any of the listed feature sets is enabled in a matching monitoring configuration (OR semantics, case-insensitive).

activatedOnHost

true (optional)

When set, only monitoring configurations scoped to the current entity are considered. Works for host configurations.

The extension's identity is resolved automatically from the document's origin — there's no extensionId field to set on the condition itself.

Example

This Entity Details definition runs one condition query that resolves an isK8s variable, then uses it to show a "Kubernetes" tab only for hosts that are Kubernetes nodes. The "Overview" tab has no conditions, so it always renders.

{
"version": "1.3.0",
"type": "EntityDetailsDefinition",
"target": { "app": "dynatrace.infraops", "nodeType": "dt.entity.host" },
"conditionContext": {
"query": "smartscapeNodes \"HOST\" | filter id == toSmartscapeId($(nodeId)) | fieldsAdd isK8s = isNotNull(fromRelationship.isNodeOf) | limit 1 | fields isK8s",
"resultFields": ["isK8s"]
},
"content": {
"type": "details",
"id": "host-details",
"content": {
"type": "tabs",
"items": [
{
"type": "tab",
"id": "overview",
"title": "Overview",
"content": [
{ "type": "metadata", "id": "host-properties", "cardTitle": "Properties" }
]
},
{
"type": "tab",
"id": "kubernetes",
"title": "Kubernetes",
"conditions": [{ "type": "dql-variable", "variable": "isK8s", "value": true }],
"content": [
{ "type": "message", "id": "k8s-note", "content": "Shown only for Kubernetes nodes." }
]
}
]
}
}
}

Where conditions can be used

SiteEvaluated

A Tab inside a tabs layout

before the layout is built

Items inside a tab's content array

before the layout is built

Health alert groups and individual health alerts

before the layout is built

DQL table columns

before the layout is built

Filters inside a filtering element

before the layout is built

Chart group sections and individual charts

before the layout is built

Actions (header, toolbar, card, chart, column, row, cell)

at render time, with row/cell data available where relevant

Loading and failure behavior

  • While the condition queries are in flight, UA withholds the document's content — there is no flash of unconditioned content followed by a layout shift.
  • If a condition query fails, the document renders without condition filtering (fail-open), so a broken query never results in a blank panel.
  • If a document has no conditionContext, all conditions fields are ignored and every element renders unconditionally.

See also

  • Document types
  • Elements overview
Related tags
ExtensionsExtensionsInfrastructure Observability