3

I have a table of sites that has a field Priority with values 'P1', 'P2', 'P3'. I want to apply rule based labeling such that when a site has Priority = P1 it should be labelled with 'P1', when it has Priority =P2 it should be labelled with 'P2', etc.

I have tried the below formula in the filter under Rule Properties window: "Priority" = P1 but when I click test I get an error saying Column P1 not found.

1
  • Welcome to gis.stackexchange! Please edit the title of your question to include enough information for future visitors to be able to find this thread when looking for the same problem.
    – underdark
    Jan 6, 2017 at 10:35

2 Answers 2

3

Under the "Filter" for rule based labeling write "Priority" = 'P1' (note the double brackets around the column, and the single brackets around the expected result). Single brackets are needed as the expression is searching for a string. The only time you don't need to use single brackets would be when searching for integers.

2

There's no need to use rule-based labeling. To label each site with the value from the Priority field, turn on labeling and select the Priority field from the drop-down menu.enter image description here

Your Answer

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

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