* * *

Author Topic: laz 1.6 vs laz 1.4 wrong Grouping Thousands  (Read 648 times)

mirce.vladimirov

  • Full Member
  • ***
  • Posts: 219
laz 1.6 vs laz 1.4 wrong Grouping Thousands
« on: December 02, 2017, 11:48:55 am »
I've use 32-bit Lazarus 1.4.2 on 32-bit Windows7 until recently and few days a go I downloaded 32-bit Lazarus 1.6.4 on a 64-bit Windows10.
In a DBGrid Thousands are grouped all right on the version  1.4.2  and wrong on the 1.6.4.
Pictures attached are showing different grouping of thousands in a DBGrid, same application, already developed but compiled with a different version of Lazarus. Dont be confused by "," and "." , in my locale the thousand separator is "." and decimal separator is ",".
The code is :
Code: Pascal  [Select]
  1.    if CheckBox1.Checked=false then begin
  2.        TFloatField(qgrid.FieldByName('budjet')).DisplayFormat   := '#,###,##0.00;-#,###,##0.00;0' ;
  3.        TFloatField(qgrid.FieldByName('razlika')).DisplayFormat  := '#,###,##0.00;-#,###,##0.00;0' ;
  4.        TFloatField(qgrid.FieldByName('ostvareno')).DisplayFormat:= '#,###,##0.00;-#,###,##0.00;0' ;
  5.    end;
  6.  

Grouping is not always the same, as you can see on the pictures , only the first column is grouped wrong.

In some forms I have DBGrid columns formated via the ObjectInspector which is also wrong.

When I say wrong, it's not always the same like on the attached pictures, sometimes there are not even formated at all.


ASerge

  • Sr. Member
  • ****
  • Posts: 472
Re: laz 1.6 vs laz 1.4 wrong Grouping Thousands
« Reply #1 on: December 02, 2017, 04:54:35 pm »
Confirm bug. FPC 3.0.4.
Code: Pascal  [Select]
  1. {$APPTYPE CONSOLE}
  2. program Project1;
  3.  
  4. uses SysUtils;
  5.  
  6. begin
  7.   Writeln(FormatFloat('#,###,##0.00', 150000));
  8.   Readln;
  9. end.
Show 15'0000.00 (I have other delimiters, but it's not important).
But FPC 3.1.1 (trunk version) work fine: show 150'000.00.

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5875
Re: laz 1.6 vs laz 1.4 wrong Grouping Thousands
« Reply #2 on: December 02, 2017, 05:52:08 pm »
Probably

r36740 | michael | 2017-07-17 18:24:05 +0200 (Mon, 17 Jul 2017) | 1 line
Changed paths:
   A /trunk/rtl/objpas/sysutils/fmtflt.inc
   M /trunk/rtl/objpas/sysutils/syshelp.inc
   M /trunk/rtl/objpas/sysutils/sysstr.inc

* Fix bugs 30950 & 29781


rvk

  • Hero Member
  • *****
  • Posts: 2974
Re: laz 1.6 vs laz 1.4 wrong Grouping Thousands
« Reply #3 on: December 02, 2017, 06:54:24 pm »
* Fix bugs 30950 & 29781
Yikes, and those didn't make it to the 3.0.x fixes branch for FPC 3.0.4 ?

Maybe it's best not to release Laz 1.8 with that version then.

zeljko

  • Hero Member
  • *****
  • Posts: 938
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: laz 1.6 vs laz 1.4 wrong Grouping Thousands
« Reply #4 on: December 02, 2017, 10:25:26 pm »
AFAIK, Laz 1.8 is in stage of packagaing atm , maybe an fpc-3.0.6 should be released with such critical bug fixed.

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5875
Re: laz 1.6 vs laz 1.4 wrong Grouping Thousands
« Reply #5 on: December 02, 2017, 10:34:13 pm »
* Fix bugs 30950 & 29781
Yikes, and those didn't make it to the 3.0.x fixes branch for FPC 3.0.4 ?

It happened between RC and final. If it doesn't get plugged by a committer, it can be overlooked (specially in cases like this where I can't oversee it easily).



 

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3262
  • I like bugs.
Re: laz 1.6 vs laz 1.4 wrong Grouping Thousands
« Reply #6 on: December 02, 2017, 10:59:58 pm »
AFAIK, Laz 1.8 is in stage of packagaing atm , maybe an fpc-3.0.6 should be released with such critical bug fixed.
FPC 3.0.6 quickly is not realistic. Lazarus 1.8 must be released with 3.0.4 as planned.
I remember talks about a "quick 3.0.4" last spring but actually it took almost 10 months (FPC 3.0.2 came out in February).
FPC 3.0 release was over 2 years ago.
How could the FPC release cycle be shortened? Apparently the build + packaging process is laborous and slow. If someone came with ideas and tools to speed it up, would it be accepted?
Unfortunately I am not a build expert but I believe there are many such people among FPC users.

wp

  • Hero Member
  • *****
  • Posts: 3953
Re: laz 1.6 vs laz 1.4 wrong Grouping Thousands
« Reply #7 on: December 07, 2017, 12:01:37 pm »
As a workaround, don't apply multiple thousand separators. One is enough to tell the formatter to group by three digits. You may also drop the '#', they are optional digits and have no effect in front of the decimal separator.
 --> use   ',0.00;-,0.00;0'    or    '#,##0.00;-#,##0.00;0'.

Look at this demo:
Code: Pascal  [Select]
  1. program Project1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. uses
  6.   SysUtils;
  7.  
  8. var
  9.   v: Double;
  10.  
  11. begin
  12.   v := 100000;
  13.   WriteLn(v:0:0);
  14.   WriteLn('#,###,##0.00;-#,###,##0.00;0 --> '+FormatFloat('#,###,##0.00;-#,###,##0.00;0', v));
  15.   WriteLn('#,##0.00;-#,##0.00;0 --> '+FormatFloat('#,##0.00;-#,##0.00;0', v));
  16.   WriteLn(',0.00;-,0.00;0 --> '+FormatFloat(',0.00;-,0.00;0', v));
  17.   WriteLn;
  18.  
  19.   v := -100000;
  20.   WriteLn(v:0:0);
  21.   WriteLn('#,###,##0.00;-#,###,##0.00;0 --> '+FormatFloat('#,###,##0.00;-#,###,##0.00;0', v));
  22.   WriteLn('#,##0.00;-#,##0.00;0 --> '+FormatFloat('#,##0.00;-#,##0.00;0', v));
  23.   WriteLn(',0.00;-,0.00;0 --> '+FormatFloat(',0.00;-,0.00;0', v));
  24.   WriteLn;
  25.  
  26.   ReadLn;
  27. end.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus