We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
qgis
Learn more about funding links in repositories.
Report abuse
There was an error while loading. Please reload this page.
1 parent bd9cdae commit 086525bCopy full SHA for 086525b
src/gui/editorwidgets/qgsrelationreferencewidget.cpp
@@ -245,8 +245,10 @@ void QgsRelationReferenceWidget::setForeignKey( const QVariant& value )
245
if ( !mReferencedLayer )
246
return;
247
248
+ // Attributes from the referencing layer
249
QgsAttributes attrs = QgsAttributes( mReferencingLayer->fields().count() );
- 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;
252
253
QgsFeatureRequest request = mRelation.getReferencedFeatureRequest( attrs );
254
0 commit comments