QGIS – Filtering a Layer with Attribute Value from Another Layer in QGIS 2.18

expressionfilterqgis

I am pretty new to Qgis and a real beginner when it comes to working with
expressions in Qgis. Maybe someone can help me with following problem:

Example

I have several Layers (like Building + House) and each of them have specific attributes values that i want to filter. So my idea was to get an extra layer Test with the attribute value that i want to filter on the other layers and put a filter expression to the attribute value A in table category_1 of layer Test. Basically to avoid rewriting the filters for each layer all the time. But I dont know how to get it done.
I tried it with get_feature and attribute() but in my Qgis 2.18 there is no help how such expressions have to look like. That makes it really hard if u have no clue.
So how can I filter with the attribute value A in category_1 of layer the Test in the layer House ?

Best Answer

If this is about Select features using an Expression enter image description here function, please try examples below:

House

"category_2" = attribute(get_feature('Test', 'ID', '1'), 'category_1')

Building

"category_3" = attribute(get_feature('Test', 'ID', '1'), 'category_1')
Related Question