2

In a QGIS 3.10 project, I've set up a relationship between two postgis table. In postgis, table A has two unique fields: "id" and "name". "Id" is the primary key but "name" is used as a foreign key for table B as "name A".

In the QGIS project's properties, I've set up the relation as so: Parent layer: layer A Referenced field: Name Child Layer: layer B Referencing field: Name A

This works as expected, I can then create attribute form for both layers, with the form of layer A having a section for showing layer B's attribute form.

However, I noticed that when I open a the attribute table of layer B, the field which should be showing "name A" is instead showing the "Id" field of layer A.

How can I set up the layer B form so that it shows "name A" as expected? (note I do not have this"error" in Postgis when i check the database in PgAdmin). Maybe I should set up a "reverse" relationship in QGIS?

1 Answer 1

1

OK, found the solution myself and posting it here for reference:

In the layer B properties, attribute form: selecting the "Name A" field will now bring new options for displaying data, including a new option in "Reference relation" tool: "Display Expression". There the field from table A to be displayed can be selected in the drop-down menu.

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.