Hello,

I would like to use the value of a field/attribute in a parent table as a 
filter in an expression used to display features in the child table.

Specifically, I have a 1:n relationship (composite) saved in my project:

Sectors (parent table with polygon geometry, a key "FID" and a field/attribute 
"TYPE")

Trees (child table with point geometry, and a secondary key "SECTORS_ID")

I would like to use this relationship in the rule-based symbology renderer so 
that, for example:

Trees whose parent Sectors have "TYPE" = 'Project' are displayed as a blue 
circle

Trees whose parent Sectors have "TYPE" = 'Parking' are displayed as a red circle

My questions:

Using the relate, how do I build my expression in the rule-based renderer so 
that I can differentiate between Trees related to a Sector of a specific type?

Should I look for a way to use « @parent » in the child table, along with the 
get_feature() and/or attribute() function ? I understand the @parent parameter 
is only used for the aggregate() function.

The expression should make use of the relate, using the value of the parent 
attribute "TYPE" ; also, the condition is not always spatial thus refFunction 
plugin is not being used. The point is also not to use a view.

I'd rather avoid the following, but as an alternative: how would I create a 
virtual field "SECTOR_TYPE" in my child table that would be filled with the 
value of the "TYPE" field located in the corresponding parent feature?

I am using QGIS 3.10.1

Thanks in advance for your help.

CJ
_______________________________________________
Qgis-user mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to