4

I want to select in a population table the growth rate between two years greather than 1.5.

In QGIS 2.18 the following expression works fine

"POP_P2014" / "POP_P2000" > 1.5

With the same data table and with the same expression, it doesn't work in QGIS 3.4.

How should i build expression in QGIS 3.4?

In QGIS 2.18 enter image description here In QGIS 3.4, don't work enter image description here

8
  • 1
    Drop the spaces, drop the parenthesis' ("), then try again.
    – Erik
    Mar 26 '20 at 8:34
  • Could you write an example? Mar 26 '20 at 9:01
  • Column1/Column2>1.5
    – Erik
    Mar 26 '20 at 9:09
  • IMHO your expression should work. Can you be so kind show a print screen of your attribute table? For instance, when I am selecting something with "Attribute" > 0.5 it works as usual.
    – Taras
    Mar 26 '20 at 9:09
  • 2
    Emilio, if both columns are integer datatypes in a shapefile, division doesn't seem to work properly in QGIS 3.10+. See this question. gis.stackexchange.com/questions/356528/… I've lodged an error report. Try using eval() or a different file type in the meantime.
    – she_weeds
    Mar 31 '20 at 7:48
2

It should work in QGIS 3.4 as well. Your expression syntax is not OK. You should write the name of fields enclosed in inverted commas aka quotation marks (""). See the difference in your QGIS 2.18 expression and 3.14. Or simply try this expression "INE_P2014" / "INE_P2000" > 1.5.

Difference in Expression

8
  • "INE_P2014" / "INE_P2000" > 1.5 it doesn't work. It was my first choice. I've tried without "" as suggested by @Erik, but it doesn't work for me either Mar 26 '20 at 9:54
  • Then problem may be something else, corrupted data or installation. Have you tried some different data or on another computer?
    – datakeen
    Mar 26 '20 at 10:02
  • 1
    maybe a configuration difference between your two qgis installs, something related with the decimal separator ? (since your screenshot doesn't seem to mean 'syntax error' but rather 'no feature selected' ...)
    – Snaileater
    Mar 26 '20 at 10:18
  • exact, does not give syntax error, but does not make the same selection as in version 2.18, when the data is the same Mar 26 '20 at 10:29
  • Are you opening the project file made in QGIS 2.18? Or you opening a new project and added this shapefile? Maybe try this. Besides are some other shapefiles working fine especially working of field calculator and use of field names in the expression?
    – datakeen
    Mar 26 '20 at 10:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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