Class: QgsExpressionNodeCondition

An expression node for CASE WHEN clauses.

Class Hierarchy

Inheritance diagram of qgis.core.QgsExpressionNodeCondition

Base classes

QgsExpressionNode

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

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

class qgis.core.QgsExpressionNodeCondition[source]

Bases: QgsExpressionNode

__init__(conditions: Iterable[QgsExpressionNodeCondition.WhenThen] | None, 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.

QgsExpressionNodeCondition.WhenThen(whenExp: Optional[QgsExpressionNode], thenExp: Optional[QgsExpressionNode]) A combination of when and then. Simple as that.

thenExp(self) QgsExpressionNode | None[source]

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

Return type:

Optional[QgsExpressionNode]

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:

Optional[QgsExpressionNode]

Returns:

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

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:

Optional[QgsExpressionNode]

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