1

In Project Properties -> Relations I've defined one relationship between two tables. And when I add a feature in the Referenced layer (parent) I want to be table add its related Referring layer (child) feature(s) in the Feature Attributes window which opens immediately after adding a feature. I was able to accomplish that with setting the Widget type of the Referencing field to Relation Reference. But there is one big problem. The Feature Attributes window opens too late (10+ seconds). It makes it slow. I don't know why it takes too long for this window to be shown when I set the type to Relation Reference. It takes too long after hitting 'Ok' in the Feature Attributes window to close the window and add the features too. How can I improve the speed?

EDIT:

Relation: enter image description here

Widget type: enter image description here

Feature attributes window: (slow when we want to show the part shown in this image which is usually opened when the Feature Attributes will be opened which causes the window to open slowly) enter image description here

The slowness has nothing to do with the parent layer. It's the child layer and that specific field type that causes the problem.

4
  • which QGIS version are you using and what data format?
    – sn1ks
    Commented Jan 27, 2022 at 6:19
  • The version is 3.16.5. The type of fields are TEXT. Layer storage is PostgreSQL database.
    – RandyO
    Commented Jan 27, 2022 at 7:08
  • can you maybe upload some screenshots of your widget settings (from your parent and your child table) and your relations-settings?
    – sn1ks
    Commented Jan 27, 2022 at 8:41
  • @sn1ks the question has been edited.
    – RandyO
    Commented Jan 27, 2022 at 11:21

2 Answers 2

1

Ok i think the issue is that you did not set up the relation in a right way.

Try the following:Project -> Properties -> Relations

Note: I have several child layers of my "Flurstücke" layer

After that, go to the layer properties of your child layer, edit the widget form to your liking (the attributes under Form Layout are the ones that will appear in your pop-up feature form). If you check out your referencing field, you should see that it is automatically set to "Relation Reference" already. Go to the properties of your parent layer and edit the feature form here. You should see here under "Relations" the relations you set up under Project -> Properties-> Relations. enter image description here

Drag & Drop them from there to the Attribute Form. None of your parent's layer fields should be set to Relation Reference

It should now work as desired.

4
  • Well, from your answer it seems like my relationship under Project -> Properties-> Relations is alright. I don't know what you mean by "go to the layer properties of your child layer, edit the widget form to your liking". But I think you mean that I should change it from Relation Reference to Text? And "If you check out your referencing field, you should see that it is automatically set to "Relation Reference" already" just makes me more confused since it did not happen. Anyway, I tried to do as your second image, (the Many to one relation) but it's still slow.
    – RandyO
    Commented Jan 27, 2022 at 13:06
  • BTW, Drag and Drop Designer has one problem in that when the number of fields are too many it does not add scroll bar which makes it impossible to work with.
    – RandyO
    Commented Jan 27, 2022 at 13:07
  • hmm okay, is it possible that you send the project file (without any data/tables) to me? mail adress is in my profile
    – sn1ks
    Commented Jan 27, 2022 at 13:19
  • sent it to your email
    – RandyO
    Commented Jan 27, 2022 at 13:58
0

There seems to be a problem with making changes in the Attributes Form section . To overcome it I had to change the qgs XML file manually. In the picture below, the left side is the file without this delay problem, the right one with the problem.

enter image description here

Just reset the field config:

<field name="counter_box_code" configurationFlags="None">
  <editWidget type="RelationReference">
    <config>
      <Option/>
    </config>
  </editWidget>
</field>

This solved the delay problem.

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.