1

I'm trying to look for certain features based on a field, but I would like to do so based on the description of the field instead of the actual value of the field (the actual values are numbers, but the description has strings with useful information).

Is there any clean way to do this using the field calculator?

I have a shapefile with the following field:

enter image description here

As you can see the description has strings values that start with a keywork '(residencial)' '(comercial)' amongst other values, what I want is to use the field calculator, for example to look for features that in the description have the key word '(residential)':

enter image description here

Something like so, this doesn't work since the actual field is a number in a string format.

0

1 Answer 1

3

Use the expression represent_value (uso): it returns the text (string) description of the corresponding value of a value map.

So to select all features that contain a description like (residential), use this expression:

regexp_match( 
    represent_value (uso),
    '(residential)'
) > 0

Attribute tables contains numbers for field uso; the labels are based on that field, using the expression represent_value (uso) to turn it to a string; yellow points are selected with the expression from above: enter image description here

1

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.