[QGIS-Developer] issues with relations and embedded forms

Alessandro Pasotti apasotti at gmail.com
Tue Feb 25 08:49:37 PST 2020


Hi,

it's probably me not being a power user, but from a few simple tests I'm
doing with relations (1:n) on spatialite/gpkg layers I'm experiencing a few
issues and I wonder if there is something I missed or if we can improve the
workflow.

My test schema is pretty simple:
-----------
table1 (parent)
-----------
fid (default: sqlite_fetch_and_increment...)
name

-----------
table2 (child)
-----------
fid
fk_table1 -> table1.fid
name

ISSUE 1:
- add a new item in table1
- in the embedded form add a table2 item
- click on "Save child layer edits" button -> backend CONSTRAINT FAILURE!
because table1 parent is not saved (and not even in the editing buffer, for
what matters)

QUESTIONS on ISSUE1:
- should we disable the "Save child layer edits" button in case the parent
is unsaved?
- what's the idea behind the "Save child layer edits" when the user cannot
even save the parent from the form, why can she save the children?
- would it make sense to check for the unsaved parent in
QgsRelationEditorWidget::saveEdits() before attempting a children save?

ISSUE 2:
- preparation: add one parent and a few children and commit
- activate identify tool and click on a parent feature
- the form opens but no children are shown in the child form, all values
are NULL, I would expect that the first child is automatically selected and
focused

ISSUE 3:
- preparation: add one parent and a few children and commit
- activate identify tool and click on a parent feature
- click on "Add Point child feature"
- click on map canvas
- another attribute form opens, I would expect that instead of opening a
new form, the embedded form was focused, with the new feature geometry
associated and ready for input of other field values, the form open may be
fixed with the option I've added here:
https://github.com/qgis/QGIS/pull/34654.

Before I attempt any further patches, I'd like to hear your opinion on how
we could make the data entry process a little bit easier and error-proof in
case of parent-child relations, especially now that QGIS is dropping the
GIS and becoming the new Access ;)

Cheers


-- 
Alessandro Pasotti
w3:   www.itopen.it
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20200225/94c64958/attachment.html>


More information about the QGIS-Developer mailing list