1

In QGIS 3.4.4, I've set a field to double numeric, precision 1, to give a useful value for hectares. The field shows nn.n but the label goes to loads of decimal places.

I've tried round but it doesn't do anything (mostly). I've looked at a number of threads, including this How to change length to 2 decimal places? but it's not working. If I set it to round only, I get the non-decimal rounded figure, but if I specify 1 or 2 places, it is ignored. I've checked & rechecked my expression [ round ("Area ha",1) ]

Any thoughts?

enter image description here

7
  • 2
    Have you tried using the round() function in the label panel of the layer properties or just in the field calculation?
    – Gabriel
    Jan 30, 2020 at 21:29
  • I went into the expression builder from the label panel, which then popultes that box with the expression. Are you suggesting that I may get a different result if I type the expression in there directly, without using the expression builder?EDIT just tried that & get the same result Jan 30, 2020 at 21:38
  • 1
    Using the label expression first is a good and quick way to troubleshoot errors like this rather than trying to run the field calculator every time and having it fail... it should be the same syntax give or take... Jan 30, 2020 at 22:03
  • round should do... You can try format_number("fieldname",1), which outputs a string instead of a number
    – JGH
    Jan 30, 2020 at 23:30
  • 3
    round() function had a bug until QGIS 3.4.4-3. Please, upgrade QGIS to latest LTR or stable version. Jan 31, 2020 at 0:02

0

Browse other questions tagged or ask your own question.