[SOLVED] DBGrid - how to show nice Numeric field from DBF? lazarus / 16-Databases ---------------------------------------------------------------------- abix_adamj_pl · 2011-03-14 12:10 I have a TBGrid component, in which I display DBF file. In dbf I have Numeric fields and I would like to show these fields in "normal" way, not engeniering. I attach screens from the application and from dbu utility, which shows real values in these fields. Can someone give me some hint, how to change type of view in db grid? Adam ---------------------------------------------------------------------- Zoran · 2011-03-14 15:19 You can set Field's DisplayFormat property. See: http://www.freepascal.org/docs- html/fcl/db/tnumericfield.displayformat.html and http://www.freepascal.org/docs-html/rtl/sysutils/format.html ---------------------------------------------------------------------- clauslack · 2011-03-14 15:39 Look at this patch here ( bug12928.diff ) (TDbf show numbers in scientific notation in TDBGrid) http://bugs.freepascal.org/view.php?id=12928 Workarround TFloatField(db.fieldbyname('field')).precision := 15 Regards. ---------------------------------------------------------------------- abix_adamj_pl · 2011-03-14 17:37 TFloatField(db.fieldbyname('Z5')).precision := 15; produces an error in compiling: project1.lpr(152,29) Error: Identifier not found "fieldbyname" Lazarus 0.9.28.2010ubuntu1 Any hint? Adam ---------------------------------------------------------------------- clauslack · 2011-03-15 00:28 You must replace db with the name of TDbf component, in my case Dbf1.  (db is the unit db.pas) EJ Code: [Select]Dbf1.open;    TFloatField(Dbf1.fieldbyname('Z5')).precision := 15;  But the best option is apply the patch bug12928.diff  to TDbf component and recompile this package. ---------------------------------------------------------------------- abix_adamj_pl · 2011-03-15 08:38 Great!!!!!! Thank you for help. Exactly should be: Code: [Select] TFloatField(Form1.DBf1.fieldbyname('Z5')).precision := 15; and after that Grid looks like a perfect woman ;-) Another question is, do you know, in which version of Lazarus patch (bug12928.diff) is applied ? Adam ---------------------------------------------------------------------- clauslack · 2011-03-15 13:27 This patch (and others for TDbf)  is not in any version. Because the developer (Micha Nelissen) is "missing" The TDbf project seems to be stalled (for 3 years) Check http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/packages/fcl- db/src/dbase/ Maybe other developer can apply this patch to the the TDbf source. ---------------------------------------------------------------------- abix_adamj_pl · 2011-03-15 13:49 Cool ;-( So, I just use it in my application and nothing more. Thanks a lot once again for help. Adam