mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
A joined feature is added only when one of its field is not null
This commit is contained in:
parent
927dea3c18
commit
11c62ca205
@ -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 );
|
||||
|
Loading…
x
Reference in New Issue
Block a user