[Qgis-user] query of a layer from another layer in select by expression

Yann Voté ygversil at lilo.org
Thu May 28 13:24:28 PDT 2020


Hi,

You can try the direct but implicit represent_value() function, if the 
filtering is by the referenced column, like this:

represent_value("referencing_field") = 'filter_value_on_referenced_layer'

Or you can try the more verbose and more explicit 
attribute()/get_feature() functions, if you want to filter by another 
column:

attribute(get_feature('referenced_layer_name', 'referenced_field', 
"referencing_field"), 'filter_field') = 'filter_value'

And be careful about quotes: 'foo' (single quotes) is a string (but may 
designates a field in other layer in some functiones), while "foo" 
(double quotes) designates a field in the active layer.

Hope this helps!

Yann

Le 28/05/2020 à 19:11, Patrick St-Hilaire a écrit :
> Hi !
> 
> Could someone tell me how to query a layer from fields of another layer 
> using select by expression? I have already created a relationship 
> between my two layers in projects.
> 
> Thank you
> 
> Patrick
> 
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
> 


More information about the Qgis-user mailing list