Geographic Information Systems Asked by Mark Thompson on May 15, 2021
I have read the QField support on how to add a series of pictures to a feature. I’ve also read other threads and GIS Stack Exchange questions and answers on this: e.g., Setting QField for 1:n photos. However, I am still confused and unable to get this working properly and was hoping that someone could provide a detailed explanation that may help others in this process.
Step 1: I create the relation between the Referenced ‘parent layer’ (= Wetland Survey) and the referencing ‘child layer’ (= Wetland_pics):
I am not entirely clear on what ‘uuid’ actually is here. I know that it is a Universal Unique Identifier, but is this necessary? Why couldn’t I use my site.code? I notice that using site.code()
as a default value gives an error, where uuid()
gives an identifier – so the system must recognize uuid for this function. This is not my primary question, but understanding this seems important in relation to the primary keys (not entirely sure of what they are).
Step 2. Building the form layout
a. Drag and Drop, set the uuid (parent relation):
b. Drag and Drop, set the Wetland Pictures (child relation):
Step 3. Setting drag and drop form in the child table (‘Wetland_pics’) – set path to attachment widget type:
Step 4. Testing the form:
The form looks fine, but I am unable to select or type anything in the "Wetland Pictures" fields in QGIS. I’m trialing the form in QField beta windows version (second image) and you can see that I get the message "Cannot add child feature: parent primary keys are not available". This is what leads me to suspect that this has something to do with uuid.
In your example, 'uuid' is a, attribute name. uuid() is a recognised function. You appear to have taken your attribute name 'site.code' and added parentheses at the end in the hope it will return something. It will not, because unless you have defined the funciton site.code(), it does not exist.
As to the 1:n setup….
Step 2, parent ‘uuid’ attribute settings look correct. But I don’t understand what you are doing with the field ‘Wetland Pictures’ - this does not need to exist. Your pictures are displayed using the ‘path’ attribute of your child table – this appears as a subform in your main form. Perhaps I’m confused, but this looks wrong to me.
Step 3, your settings for ‘path’ look correct. But you don’t show your settings for ‘site.code.pic’. This should be a ‘Relation reference’ widget, with the relation set to the name of the relation you created in Step 1 (I note you have this set to be generated automatically. That’s fine, so as long as there are not numerous other relations the autogenerated name should easy enough to recognise and select from a drop down list immediately below the widget type box (set to ‘Relation reference’).
Step 4. Site.code is Null because you have not set a valid default value.(but that does not affect 1:n photos). Also note in your subform ‘Wetland Pictures’ site.code.pic is not popoulated. It should be automatically filled in with the same uuid as the Wetland Survey (see my comments regarding step 3 above).
If this doesn't help, I can probably fix it pretty quickly if you want to share the project.
Answered by Oisin on May 15, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP