When evaluating an expression with a missing referenced field, this will be replaced with [fieldname].

When calculating data defined values, this will be counterproductive.
A field with a data defined value might work well in the expression builder (because fiels are all present) but fail in the legend, because it's rendered with no feature and hence fields. With this change, we can at least use `try("fieldname", 0)` to fallback to a default value.
This commit is contained in:
Matthias Kuhn 2019-12-07 13:13:19 +01:00
parent 3bf8d96ad3
commit e1b016bc2b

View File

@ -1270,7 +1270,8 @@ QVariant QgsExpressionNodeColumnRef::evalNode( QgsExpression *parent, const QgsE
return feature.attribute( mName );
}
}
return QVariant( '[' + mName + ']' );
parent->setEvalErrorString( QStringLiteral( "Column '%1' not found" ).arg( mName ) );
return QVariant();
}
QgsExpressionNode::NodeType QgsExpressionNodeColumnRef::nodeType() const