I would like to have a line ("ll")and a point-layer ("pl") in QGIS, in this case for example each of them representing the point- or line-geometry of maintenance tasks in the field.
The third layer ("ml") in the project is a geometryless table, which contains all maintenance-tasks (autoincrement id) regardless their geometry-type.
Each "pl"/"ll"-layer has a foreign-key-field for the id of "ml"-table. All are PostgreSQL tables.
Till now the tables were filled with data independently from each other.
I'd like to collect the data using parent/child-forms in the future to avoid renundant data.
To achive this I set up a relation between geometry tables and geometryless-maintenance-tasks-table. Each of the geometry-layers ("ll"/"pl") is associated to the same "ml"-table. As a result I got a parent / child form, which shows all existing maintenance-tasks as expected for all former collected data.
If I digitize a new "ll"/"pl"-parent-feature and fill data in the "ml"—child-subform the connection between child and parent is lost for the new data.
Now it is possible to read parent-values (i.e. id's)(https://github.com/qgis/QGIS/pull/34827 - from QGIS 3.14. on) and store them in my child-table. In my case this does not help because I have two parent-layers, which will have the same ID in both tables. So referencing to the layer-id would give wrong results. So I have to work with foreign-keys ("ml"-id) in the parent-table. I have to write the ID of the child-table-row as a foreign-key to my parent-table. When digitizing the maintenance-tasks I can not know the correct ID's because the child-id is only shown as nextval('….':regclass) before saving the data to database.
Does anybody know how to solve the problem or is there a different approach ?