Skip to content
Permalink
Browse files

Set missing expression context in some filters

In some filters the expression context was not set, so that references to
variables would only work in the preview, but not when actually using them.
  • Loading branch information
dgoedkoop authored and nyalldawson committed Jan 20, 2018
1 parent 9451f2e commit fcbf4cb1f1ba05cd4dd199c1144bf4cc2c9c1d5c
@@ -137,6 +137,8 @@ int QgsAtlasComposition::updateFeatures()
// select all features with all attributes
QgsFeatureRequest req;

req.setExpressionContext( expressionContext );

std::unique_ptr<QgsExpression> filterExpression;
if ( mFilterFeatures && !mFeatureFilter.isEmpty() )
{
@@ -118,6 +118,8 @@ QgsValueRelationFieldFormatter::ValueRelationCache QgsValueRelationFieldFormatte
request.setSubsetOfAttributes( QgsAttributeList() << ki << vi );
if ( !config.value( QStringLiteral( "FilterExpression" ) ).toString().isEmpty() )
{
QgsExpressionContext context( QgsExpressionContextUtils::globalProjectLayerScopes( layer ) );
request.setExpressionContext( context );
request.setFilterExpression( config.value( QStringLiteral( "FilterExpression" ) ).toString() );
}

@@ -220,6 +220,8 @@ int QgsLayoutAtlas::updateFeatures()
// select all features with all attributes
QgsFeatureRequest req;

req.setExpressionContext( expressionContext );

mFilterParserError.clear();
if ( mFilterFeatures && !mFilterExpression.isEmpty() )
{

0 comments on commit fcbf4cb

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