1

I need to show labels for coded values recorded in one single field, i.e.:

Crops Field
Row 1: 1 2 3
Row 2: 1 3
Row 3: 1 4

Codes: 
1 - Maize
2 - Beans
3 - Sugar Cane
4 - Others

I want to show the labels for this data within a QGIS form, when a user clicks for information, is this possible, I can´t find an appropriate controller.

2
  • I think you can create a custom function for this. I don't know how to code the whole thing, so here's some pseudocode: Create an empty array. case when regexp_match("Crops Field", '1') then append 'Maize' to the array. Repeat for all crop values.
    – csk
    Commented Jul 2, 2019 at 20:56
  • Or have a look at the Value Relation field edit widget, which allows multiple selections. Maybe you can set that up to interpret your data.
    – csk
    Commented Jul 2, 2019 at 20:57

1 Answer 1

1

If you right click on your layer and go to to properties. From here select the attributes option and you'll see a 'fields' drop down with your fields listed below. Click on your fields with the codes and change the widget type to 'value map'. Within here you can now create your code with the description. In my example below code 1 shows as the description hello when you click the information tool.

enter image description here

1
  • Hi @Chris thanks for the idea, but this field has many codes (as much as multiple selections a user selected), i.e it could have a "1" for Hello, then it could have a "1 2" for "Hello" and "Carlos" at the same time, and so on. So I need to be able to show values that are togheter "mixed" in a single field, only separated by a space. Commented Jul 1, 2019 at 15:18

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.