[Qgis-user] Qgis 3.28 : Relational value form (spatial intersection)

Sem Riemens semriemens at gmail.com
Fri Dec 30 04:48:15 PST 2022


Hi Laurent,

I think you are very close. Maybe you've already figured it out in the
meantime. If you press the E button on the screen you show in the
picture, you will see the department names appearing in the preview
section in the bottom of the screen. If not then there is an error in
the aggregate expression, but it looks fine to me.
When you use a filter expression, what this does is filter the
dropdown list with department names. So in your case you will have a
filtered dropdown list with only one choice, the corresponding
department. But it needs a TRUE or FALSE value for each department, to
know whether it should be in the filtered dropdown or not. So I think
it will work when you write the filter expression like this:
"nom_dep" = aggregate(...)

However I recommend instead to set your aggregate expression (as you
have it now, not with the added part "nom_dep" = ) as the Default
value expression. You might need to scroll down to see the section
where you can enter the Default value. There is a checkbox 'Apply
default value on feature update' if you want the value to be set not
only on new points, but also when editing existing ones. When you do
it like this you will get the complete dropdown with all department
names, but the correct one will already be selected.

Another recommendation is to set the key column (Colonne clé) to
nom_dep, the same as the value column. As you have it now, QGIS will
show you the department name but it actually puts the department ID in
the database. When you make an export, you won't see the name but only
the gid. I almost always keep the key and value column the same, then
what is shown to me is the same as what is written in the data.

Hope this helps! Let me know if it worked.
Best regards,

Sem Riemens


More information about the QGIS-User mailing list