Skip to content

Commit 086525b

Browse files
committedNov 4, 2015
Pass referencing record instead of referenced
1 parent bd9cdae commit 086525b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed
 

‎src/gui/editorwidgets/qgsrelationreferencewidget.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,10 @@ void QgsRelationReferenceWidget::setForeignKey( const QVariant& value )
245245
if ( !mReferencedLayer )
246246
return;
247247

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

251253
QgsFeatureRequest request = mRelation.getReferencedFeatureRequest( attrs );
252254

0 commit comments

Comments
 (0)
Please sign in to comment.