Recent

Author Topic: DBGrid + Zeos do not show decimals  (Read 9557 times)

Pere

  • New Member
  • *
  • Posts: 11
DBGrid + Zeos do not show decimals
« on: February 05, 2010, 01:32:58 pm »
Sorry for my bad English.

With Firebird 2.1 + ZQuery the DBgrid do not show the decimals. (20.43 show 20).

I solved it manually adding (and formating) columns to DBGrid, but it is not a good solution if you use the same grid for different datasets.

There is another solution to solve it automatically?

Thanks,

JD

  • Hero Member
  • *****
  • Posts: 1908
Re: DBGrid + Zeos do not show decimals
« Reply #1 on: February 05, 2010, 06:00:36 pm »
Put the format string in the DisplayFormat property of the DbGrid column in your form. That way you don't need to format the column in your code.

Be aware however that this format will apply to all datasets that are displayed using the DBGrid unless you change it manually again in your code.  :D
Linux Mint - Lazarus 4.0/FPC 3.2.2,
Windows - Lazarus 4.0/FPC 3.2.2

mORMot 2, PostgreSQL & MariaDB.

lazguy

  • Jr. Member
  • **
  • Posts: 78
Re: DBGrid + Zeos do not show decimals
« Reply #2 on: September 01, 2010, 05:59:59 pm »
It seems that Zeos have a bug when run on Linux. I have this problem also. If I am not wrong on Windows everything is Ok. (or if I am wrong) only the Delphi Version of Zeos is Ok. The problem is not only with DBGrid.

garlar27

  • Hero Member
  • *****
  • Posts: 652
Re: DBGrid + Zeos do not show decimals
« Reply #3 on: September 01, 2010, 08:01:55 pm »
I have the same decimals problem with TDbf and DBGrid. DBGrid in some cases show decimals in scientific format, some times shows 1 rounded decimal when it should show 2... I think the problem is in DBGrid.

cpalx

  • Hero Member
  • *****
  • Posts: 754
Re: DBGrid + Zeos do not show decimals
« Reply #4 on: September 02, 2010, 07:18:11 pm »
try to change  "," decimal to "." decimal. believe me that is the error.

guidoaerts

  • New Member
  • *
  • Posts: 12
Re: DBGrid + Zeos do not show decimals
« Reply #5 on: September 20, 2010, 10:13:00 pm »
you can also change the displayformat property of the float-data-type fields  of an opened tztable or tzquery; that leaves your grid unaffected for other datasets

guido

Pere

  • New Member
  • *
  • Posts: 11
Re: DBGrid + Zeos do not show decimals
« Reply #6 on: October 18, 2010, 10:06:08 am »
I solved dinamically by:

  ZQuery1.Active:= True;

  with ZQuery1 do
  begin
   for i := 0 to FieldCount-1 do
   begin
    if Fields.FieldKind = fkData then if Fields.DataType =ftFloat then
     TFloatField(Fields).DisplayFormat := '0.00';
   end;
  end;

cpalx

  • Hero Member
  • *****
  • Posts: 754
Re: DBGrid + Zeos do not show decimals
« Reply #7 on: October 19, 2010, 03:43:52 am »
good ...

 

TinyPortal © 2005-2018