-
Hello everyone, I'm currently working on a Qfield project in offline editing dealing with different PostGIS layers to be updated on field. The last test resulted in a series of problem connected to the element ID value stored and visibile in Qfield and the corresponding one in the syncronized QGIS project. Also, a layer that is part of a 1:n relationship does not allow to add a child element in its form in Qfield environment showing the following error message: "Cannot add child feature: parent primary keys are not available". I don't know if this two issue are connected. Reproduction Steps:
Expected behavior:Qfield opens the child form for editing all the needed attributes for the child element before saving. Observed behavior:The error "Cannot add child feature: parent primary keys are not available" appears on screen and the child form doesn't open. This happens only with newly created element in the parent layer. It does not happen with element already existing in the parent layer in the project for which it is easily possible to add child features as expected. Screenshots and GIFsQField version: [Qfield 1.10 (1da006)] Additional information:
Thanks in advance for your kind support and help in understanding and solving this issue, Federica |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Did you configure a default value for the id field in qgis? |
Beta Was this translation helpful? Give feedback.
-
Thanks @m-kuhn for your help! In this way, the editing in QField works fine, indicating increasing values for the ID and making possible to include the information of the 1:n relation elements. However, when I syncronize the project back in QGIS, I obtain the following PostGIS error regarding the 1:n relation and its foreign key (even if the element with the id_grupposegnale=43 is visible in the table "t_grupposegnale": Insert or update on table "r_segnalefisico" violates foreign key constraint "fk_segnalefisico" So, in the "updated" QGIS project after the sync procedure I can see the newly added parent elements but without the associations to their child(ren) feature(s). The children features, however, are correctly stored in their non spatial table. This is an example of the exported Qfield project for offline editing in which the problem occurs: Am I missing any particular steps in setting the offline editing? Thanks again in advance for the support! |
Beta Was this translation helpful? Give feedback.
Did you configure a default value for the id field in qgis?
Qfield needs to be able to generate a unique id without a database connection if you are working offline