TransWikia.com

How to filter dropdown options in QGIS attribute table?

Geographic Information Systems Asked by Terisha Pillay on February 25, 2021

I have the following layer table

Prim  | Secondary      |Tertiary

Apple | Apple Pen      | Apple Pen White
Apple | Apple Pen      | Apple Pen Red
Apple | Apple Phone    | Apple Phone Black
Apple | Apple Phone    | Apple Phone Silver

Banana| Banana Bread   | Banana Bread Chocolate
Banana| Banana Smoothie| Banana Smoothie Sugar
Banana| Banana Yoghurt | Banana Yoghurt Smooth
Banana| Banana Yoghurt | Banana Yoghurt Fruit

Car   | Car Toyota     | Car Toyota Yaris
Car   | Car Toyota     | Car Toyota Corolla
Car   | Car Ford       | Car Ford Figo

I was able to use value relations and a value map to create a drop-down for 2 levels.

I used a value map for the Primary
QGIS Screenshot

I used a value relation widget for the secondary.
I used the expression : "Primary Code"= current_value(‘Primary’)

QGIS Screenshot
However, I am struggling to get the third level.

It should be able to limit the choices you can choose when editing the attribute table.

eg.

If I choose Apple in the Primary column then in the second column, I should only be able to select Pen or Phone, if I chose Pen then in the Tertiary column, I should only be able to select White and red and Black or silver if I chose Phone.

One Answer

Just do a value relation with the expression:

"Primary Code"= current_value('Primary') AND "Secondary Code"= current_value('Secondary')

Correct answer by Stocker Antoine on February 25, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP