2

I'm applying a Value Map widget to two text fields in my layer. The two fields are as follows:

two text fields

I have a hierarchy consisting of Landcover, and under that Landuse, where the color is code for the available option. For example, Residential is only a Built-up landcover, and Open only has Grassland and Woodland to chose from.

I want to apply a widget to the Lower field, where based upon the selected value of Upper, it display only the available choices for Lower

How can this be achieved with QGIS Attribute Form widgets, or other Layer Properties configurations?

1

1 Answer 1

1

The video below shows the result you want to get?

enter image description here

If so, follow these steps:

  1. Create a table with unique values with three fields class, subclass, is_class_uniq (fill the first two fields, the third will be filled in automatically and must be boolean type, see step 3).
  2. Create another table with two fields cla, sub_cla (it will have popup lists). Set up auto update (see how to do it here) for the field is_class_uniq using the formula:
if(
   "fid" = array_min(
                     array_agg("fid", group_by:="class")
                     ),
    true, false)
  1. Fill in Filter expression box with these formulas below, cla field:
"is_class_uniq"

and sub_cla field:

current_value('cla') = attribute( $currentfeature, 'class') 

as shown in the pictures below:

enter image description here__ enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.