2

The functioning of my project under QGIS is based on the use of information between parent and child (relation layers).

I need to access specific information to control visibility of containers and filter lists.

In my example, I have 2 layers: [T]_DATA_PT (parent) and [T]_SURVEYS_Flora (child).

When I add the information "03-Flora" in the field "COMPART", I need to access this information in the field "COMP" of the child layer (see pictures).

Pic Pic2

My first solution was to update the id with some information like "id" = uuid || '@' || "COMPART". The relation make it possible to access the field "COMPART" of the parent through the field "id".

Unfortunately, this brought to errors on Qfield with residual information between several entities (in the parent layer).

I tried to use a double relation (relation on "id" and "COMPART"), but it cannot work this way. It also doesn't work with "value relation" widget, the value is only found when the parent's form is closed.

Do you know a better solution ?

I share a small project to illustrate my issue. QGISProject

1
  • I resolved a part of my issue par simply joining the layer parent to the child. But in this situation, I can't join the child to the parent, to get information when it's still in the parent, not saved, form. I don't know how to do so.
    – Giene
    Oct 6, 2022 at 16:28

1 Answer 1

1

To resolve my issue, I finally changed the way my project was working.

First, every field which was in the parent layer and supposed to appear in the child layer, migrate directly in the child layer (no more in the parent layer). In this example: field "COMPART" is now located in the child layer. Then I joined child layer with parent layer to have the information in the parent layer, when the two layers are saved.

In this way, I avoided really problematic errors on Qfield and I stopped trying to pass information through the field "id" which also brought me to lose data sometimes.

Finally, except through the field "id", I never found another way to access information of the parent layer through the child layer, while the parent is still in edition mode.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.