Skip to content
Permalink
Browse files

A joined feature is added only when one of its field is not null

  • Loading branch information
pblottiere committed Aug 22, 2017
1 parent 927dea3 commit 11c62ca2050c0d6003a512e7b11a2994a531f370
Showing with 18 additions and 1 deletion.
  1. +18 −1 src/core/qgsvectorlayer.cpp
@@ -2718,7 +2718,24 @@ bool QgsVectorLayer::addFeaturesToJoinedLayers( QgsFeatureList &features, Flags
joinLayer->updateFeature( existingFeature );
}
else
joinFeatures << joinFeature;
{
// joined feature is added only if one of its field is not null
bool notNullFields = false;
Q_FOREACH ( const QgsField &field, joinFeature.fields() )
{
if ( field.name() == info.joinFieldName() )
continue;

if ( !joinFeature.attribute( field.name() ).isNull() )
{
notNullFields = true;
break;
}
}

if ( notNullFields )
joinFeatures << joinFeature;
}
}

joinLayer->addFeatures( joinFeatures );

0 comments on commit 11c62ca

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