MerginMaps / MerginMaps/mobile

Relation Reference filtering on Attribute Form does not work in Mergin Input

Open
#3,011 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement forms relations
Dominant language
C++
Stars
388
Forks
87
Avg merge
2d 7h
Merged PRs (30d)
20

Description

Summary

We are working with a relational database structure within a GeoPackage and we are trying to create an Attribute Form for a geometry layer. One of the fields is a Relation Reference to another table which is a dictionary of values. In our real example, the list of values in this dictionary will be over 2000, which means it is not ideal if a user needs to scroll through them all. Therefore, we are trying to apply a filter to this drop down, based on a second attribute of the dictionary table. This filter works fine in QGIS, but does not appear in Mergin Input.

To Reproduce

We found that this can be replicated in a minimal way using the following steps:

  • Create a new project in QGIS using the MerginMaps plugin option New basic QGIS project
  • Modify the Survey_points.gpkg by adding a new field to the Survey_points table
    • This new field must be a foreign key to a new child table
    • The new child table must have a primary key field and 2 additional text fields (in this example, name and type)
  • Modify the Survey_points attribute form with the new Relation Reference field to filter the values by one of the additional columns from the child table as below (in this case, it is filtered by type):
    image
  • Sync the project in QGIS
  • Sync the project in Mergin Input
  • At this point, you can view the attribute form in Mergin Input and see that the filtering is not applied to the Relation Reference attribute
Expected Result

The attribute form within Mergin Input should feature an additional drop down menu to reduce the selection options using the filter applied in QGIS, similar to what is seen in QGIS here where there are 2 drop down menus:
image

Instead, there is only 1 basic drop down menu in the attribute form within Mergin Input which shows all of the values:
image
image

Example Project

You can see this issue in this public Mergin project.

Software Versions
  • QGIS 3.34.0 for Windows
  • Mergin Maps QGIS Plugin 2023.4.1
  • Mergin Maps mobile Input 2.5.0 for Android

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the relation-reference form with the public drill-down-forms project and compare its QGIS attribute form with the Mergin Input form. Trace how the child-table filter and dependent dropdown are represented and handled in Mergin Input. Done means the filter is applied and the relation-reference control offers the reduced selection options shown in QGIS.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, cpp, ios
Domain
database, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.