3

When I use the modeler (Pic. 1, Layer: "Gemeindegrenze/2500 m Radius" - yellow mark), the results are always shown in a value with 16 decimal points (Pic. 2) and It seems to be impossible to change it for 2 decimal points, while using the value expression (Pic. 2, red mark), even when I set up 2 decimal points (Pic. 2, orange mark) it is not working out. I found out that it does show me the number in 2 decimal points when I change the value expression to "area_perce", while keep the setup for 2 decimal points (orange mark). But in that way I can`t name the area in the map.

On the other hand (Pic. 1, Layer: "Gemeindegrenze" - blue mark), I also found out that when I skip the field calculator by using the modeler and calculate the "area_perce" (percentage of area) only by field calculator (by hand), it works perfectly with the value expression (Pic. 3, red mark) and does'nt even need to set up the number of decimal points (Pic. 3, orange mark). So I am pretty sure that the problem is somewhere in the field calculation from the modeler. At both layers I use a format template that I saved before, to have same settings and changing the result field type or result field length (Pic. 1, brown mark) did`nt change anything.

enter image description here

enter image description here

enter image description here

1 Answer 1

4

As your are using || to concatenate strings your value in area_perce will be handled as a string as well, ergo the "Format Numbers" which you set to two decimals will be ignored. For your labels you can try this expression:

"GEN" || ': ' || round("area_perce",2) || '%'

this will reduce the decimals to two before it's type is converted to string

3
  • Awesome, it works :) thank you very much.
    – lesto
    Aug 17, 2021 at 11:05
  • Do you maybe know a file or something where I can see the possible commands for the value expressions?
    – lesto
    Aug 17, 2021 at 11:07
  • no, not really - but the QGIS help is pretty good, for example it states for "||" : "Joins two values together into a string."
    – sn1ks
    Aug 17, 2021 at 12:59

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.