Bug report #5726

Labelling: number formatting does not work for expressions

Added by Leyan Ouyang over 11 years ago. Updated almost 11 years ago.

Assignee:Nathan Woodrow
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:Yes Resolution:fixed
Crashes QGIS or corrupts data:No Copied to github as #:15240


On the new labelling engine, there is the possibility to format numbers by limiting the decimal places and adding a + sign if the number is positive. However, it only works when choosing directly a field, not after the evaluation of an expression. This is especially an issue for $length that comes with a very impressive but quite useless precision and makes for unreadable labels by default. It also leads to some counter-intuitive behavior where choosing an expression like "value" does not give the same result as choosing the field "value".

I join a patch that extends the ability to format number to the expressions.

label_number_formatting_expression.diff Magnifier - patch to format result of expressions in labeling (1.83 KB) Leyan Ouyang, 2012-06-03 03:50 AM


#1 Updated by Giovanni Manghi over 11 years ago

  • Assignee set to Nathan Woodrow

#2 Updated by Paolo Cavallini over 11 years ago

  • Target version set to Version 2.0.0

#3 Updated by Nathan Woodrow almost 11 years ago

  • Resolution set to fixed
  • Status changed from Open to Closed

There is now a format_number function in master.

#4 Updated by Larry Shaffer almost 11 years ago


Issue should also be fixed with 45f374f

Also available in: Atom PDF