Skip to content

Foreign key child feature fix#4356

Open
gabriel-bolbotina wants to merge 2 commits intomasterfrom
fix/1-to-n-foreign-key
Open

Foreign key child feature fix#4356
gabriel-bolbotina wants to merge 2 commits intomasterfrom
fix/1-to-n-foreign-key

Conversation

@gabriel-bolbotina
Copy link
Contributor

@gabriel-bolbotina gabriel-bolbotina commented Feb 27, 2026

Modified logic in attribute controller as such:

  • if the child feature form has the foreign key field visible, keep the code as it was
  • if the field is not visible, search for the field in the child layer (not only in the visible form fields), and pre-fill the relation

@github-actions
Copy link

📦 Build Artifacts Ready

OS Status Build Info Workflow run
macOS Build 📬 Mergin Maps 64291 dmg Expires: 28/05/2026 #6429
linux Build 📭 Build not yet complete or failed.
win64 Build 📬 Mergin Maps 56242 win64 Expires: 28/05/2026 #5624
Android Build 📬 Mergin Maps 773951 APK [arm64-v8a] Expires: 28/05/2026 #7739
Android Build 📬 Mergin Maps 773911 APK [armeabi-v7a] Expires: 28/05/2026 #7739
iOS Build 📬 Build number: 26.02.868011 #8680

@gabriel-bolbotina gabriel-bolbotina changed the title Initial draft Foreign key child feature fix Mar 2, 2026
Added comments
@Withalion Withalion added the FROZEN 🥶 do not merge before upcoming release label Mar 2, 2026
@github-actions
Copy link

github-actions bot commented Mar 2, 2026

📦 Build Artifacts Ready

OS Status Build Info Workflow run
macOS Build 📬 Mergin Maps 64331 dmg Expires: 31/05/2026 #6433
linux Build 📬 Mergin Maps 64441 x86_64 Expires: 31/05/2026 #6444
win64 Build 📬 Mergin Maps 56281 win64 Expires: 31/05/2026 #5628
Android Build 📬 Mergin Maps 774351 APK [arm64-v8a] Expires: 31/05/2026 #7743
Android Build 📬 Mergin Maps 774311 APK [armeabi-v7a] Expires: 31/05/2026 #7743
iOS Build 📬 Build number: 26.03.868411 #8684

@gabriel-bolbotina gabriel-bolbotina marked this pull request as ready for review March 2, 2026 09:37
Comment on lines 134 to 144
while ( formItemsIterator != mFormItems.end() )
{
std::shared_ptr<FormItem> itemData = formItemsIterator.value();
if ( itemData->field().name() == fieldPair.referencingField() )
if ( itemData->field().name() == referencingField )
{
QVariant fk = mParentController->featureLayerPair().feature().attribute( fieldPair.referencedField() );
setFormValue( itemData->id(), fk );
setFormValue( itemData->id(), foreignKey );
fieldFound = true;
break;
}
++formItemsIterator;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! :) One suggestion, how about we skip (remove) this while loop altogether and search for the field the new way that you introduced?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FROZEN 🥶 do not merge before upcoming release

Projects

None yet

3 participants