I am using QGIS 3.28.9.
I need to complete a field from a building's layer with the field's values from a plot's layer, based on the location of the buildings. At first I thought of doing it through the "Join attributes by location" tool, but I have some restrictions that difficult this. I'm working directly in the layers on the database, so any solution which requires to create a new layer is not possible for me. Also, I'm not allowed to create new fields in the attribute table, I can only modify the values of the existing columns which I have been doing manually.
Said this, I've tried doing some things, but without succeeding:
1. Use the "Join attributes by location" tool to create a new layer with the values I need, then try to pass the values to the original layer through an id field (this is where i have problems). I tried doing this by editing the column with an expression, following the next idea:
if( "object_id(layer1)" = "object_id(layer2)" , "field_value(layer2)" , "field_value(layer1)"
(If the object id is the same in both tables, the register takes the value from table 2, if not, it maintains the original value (NULL)). However, I couldn't find the way to cite the second layer in the script.
2. I tried doing a relation through Layer Properties / Attribute Form, to complete the field's values directly with the intersecting plots values, following the answer from this post QGIS 3.28 : Relational value form (spatial intersection)
While I could do it, I found some problems with it: The result is a selection list with two options: open and close brackets (), and the value from the plots layer (see image below). Apparently I have to select the value in each register manually. Also, I couldn't find a way to make this values the definitive values of the field. If I delete the relation the values disappear. Finally, and most important, I can't find a way to do this only for the selected elements form the layer, which is a problem, because I don't want to do it to the whole layer (It would change the values in another areas I'm not working with and ti would be a disaster).
3. I didn't try it, but maybe it's possible to do this using PostGIS. However, my knowledge about this is very limited.