Skip to content
Permalink
Browse files

Fix QgsExpressionNodeColumnRef::prepareNode

Look also for the attribute in the feature, as it is done by evalNode()
  • Loading branch information
mhugo committed Feb 13, 2019
1 parent aaed9ff commit 61db81071ac63e5f0e3b3d4d3a0d00894a7db8ab
Showing with 6 additions and 4 deletions.
  1. +6 −4 src/core/expression/qgsexpressionnodeimpl.cpp
@@ -1261,16 +1261,18 @@ bool QgsExpressionNodeColumnRef::prepareNode( QgsExpression *parent, const QgsEx
QgsFields fields = qvariant_cast<QgsFields>( context->variable( QgsExpressionContext::EXPR_FIELDS ) );

mIndex = fields.lookupField( mName );
if ( mIndex >= 0 )

if ( mIndex == -1 && context->hasFeature() )
{
return true;
mIndex = context->feature().fieldNameIndex( mName );
}
else

if ( mIndex == -1 )
{
parent->setEvalErrorString( tr( "Column '%1' not found" ).arg( mName ) );
mIndex = -1;
return false;
}
return true;
}

QString QgsExpressionNodeColumnRef::dump() const

0 comments on commit 61db810

Please sign in to comment.
You can’t perform that action at this time.