I simply want to get a specific attribute (f.e. as label or default value in form) of a feature within another feature. Aggregate could do the job but it don't.
Hard for me to write it down, so let me explain on the screenshot below: All polygons are in the same layer. The green polygon is labeled with the expression:
aggregate('SameLayer','concatenate', to_string("Number"), intersects($geometry, geometry(@parent)))
That works fine so it tells me, I'm on the right way! All intersection features (101, 102, 103) are written to the label (or later to the attribute form). Since I just want the number of the the polygon, where the green one complete fits within, I changed 'intersects' to 'within' (or 'contains') and expect as result: 102 - but it don't!
aggregate('SameLayer','concatenate', to_string("Number"), within($geometry, geometry(@parent)))
The reason is, the green polygon touches with 3 of its sides, the parent polygon. If I draw the polygon complete within the parent, the expression works.
I wonder what could be the right geometry function in my case, and if Aggregate is the right way to solve that trivial task?