Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Pass referencing record instead of referenced
  • Loading branch information
elpaso committed Nov 4, 2015
1 parent bd9cdae commit 086525b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/gui/editorwidgets/qgsrelationreferencewidget.cpp
Expand Up @@ -245,8 +245,10 @@ void QgsRelationReferenceWidget::setForeignKey( const QVariant& value )
if ( !mReferencedLayer )
return;

// Attributes from the referencing layer
QgsAttributes attrs = QgsAttributes( mReferencingLayer->fields().count() );
attrs[mFkeyFieldIdx] = value;
// Set the value on the foreign key field of the referencing record
attrs[ mReferencingLayer->fieldNameIndex( mRelation.fieldPairs().at( 0 ).first )] = value;

QgsFeatureRequest request = mRelation.getReferencedFeatureRequest( attrs );

Expand Down

0 comments on commit 086525b

Please sign in to comment.