Class: QgsExpressionNodeCondition

An expression node for CASE WHEN clauses.

List of all members, including inherited members

Class Hierarchy

Inheritance diagram of qgis.core.QgsExpressionNodeCondition

Base classes

QgsExpressionNode

Abstract base class for all nodes that can appear in an expression.

Constructor

__init__

Classes

WhenThen

Represents a "WHEN.

Abstract Methods

clone

Methods

conditions

The list of WHEN THEN expression parts of the expression.

elseExp

The ELSE expression used for the condition.

Virtual Methods

In PyQGIS, only methods marked as virtual can be safely overridden in a Python subclass of QgsExpressionNodeCondition. See the FAQ for more details.

evalNode

prepareNode

simplifiedNode

class qgis.core.QgsExpressionNodeCondition[source]

Bases: QgsExpressionNode

__init__(conditions: Iterable[QgsExpressionNodeCondition.WhenThen], elseExp: QgsExpressionNode | None = None)

Create a new node with the given list of conditions and an optional elseExp expression.

Parameters:
class WhenThen[source]

Bases: object

Represents a “WHEN… THEN…” portation of a CASE WHEN clause in an expression.

__init__(whenExp: QgsExpressionNode | None, thenExp: QgsExpressionNode | None)

A combination of when and then. Simple as that.

Parameters:
clone(self) → QgsExpressionNodeCondition.WhenThen | None

Gets a deep copy of this WhenThen combination.

Return type:

QgsExpressionNodeCondition.WhenThen|None

thenExp(self) → QgsExpressionNode | None[source]

The expression node that makes the THEN result part of the condition.

Return type:

QgsExpressionNode|None

Returns:

The expression node that makes the THEN result part of the condition.

whenExp(self) → QgsExpressionNode | None[source]

The expression that makes the WHEN part of the condition.

Return type:

QgsExpressionNode|None

Returns:

The expression node that makes the WHEN part of the condition check.

abstract clone(self) → QgsExpressionNode | None[source]
Return type:

QgsExpressionNode|None

conditions(self) → list[QgsExpressionNodeCondition.WhenThen][source]

The list of WHEN THEN expression parts of the expression.

Return type:

list[QgsExpressionNodeCondition.WhenThen]

Returns:

The list of WHEN THEN expression parts of the expression.

elseExp(self) → QgsExpressionNode | None[source]

The ELSE expression used for the condition.

Return type:

QgsExpressionNode|None

Returns:

The ELSE expression used for the condition.

virtual evalNode(self, parent: QgsExpression | None, context: QgsExpressionContext | None) → Any[source]
Parameters:
Return type:

Any

virtual prepareNode(self, parent: QgsExpression | None, context: QgsExpressionContext | None) → bool[source]
Parameters:
Return type:

bool

virtual simplifiedNode(self) → QgsExpressionNode | None[source]
Return type:

QgsExpressionNode|None