We help IT Professionals succeed at work.

Hoist the colors! We’ve added location flags to usernames sitewide, so it's easier to connect with the global community on EE. View My Profile


Help : Delphi 3.0 Floating Point Types

westy100697 asked
Last Modified: 2010-04-06
My Question is as follows......

 I am currently writing a program that will include a Database Structure Viewer as per Database DeskTop. Now I am
able to get all the fields pertaining to a particular table and also their sizes. ALL except the floating point numbers which
do not return anything in their size property. I need some way of reading their size ie their width and number of decimal places. I am sure this will be easy but I have just hit a brick wall and cannot seem to come up with a solution. This is to be used as a utility in a much larger program if the users happen to have database problems down the track.  Anyway
if you can help then you will get the points.

Thanks in Advance,
Watch Question


My help file for TField's Size property says "The interpretation of Size depends on the data type." and in particular for fields of type tfFloat "Size is not used; its value is always 0."

Hi again

There is also the DataSize property for fields.  Again, the help file has the following to say:
"For float fields, DataSize is always 8. Database tables store float fields as a Double, which is the same as the type used by TFloatField."



            This much I already know. The problem seems to be to try and diplay the tables
Structure information in a stringgrid. I am unable to ascertain for example if a TFloatfield that I have set through the Database Desktop has for example the following settings...

Field Name     Type      Size      Decimals

MYFIELD         F            6              3

This is the sort of info I require as if I do updates of the Tables for clients and I forget to send them the updated tables then I want to be able to get them to change the structure
while in the program. Otherwise I will get messages like "field 'MYFIELD' not of expected type"  . This will occur if I have for example changed the size of the field or the number of decimal places and this is what I want to be able to cover for. I hope this might shed some
more light on what I am trying to do.

PS.  As you stated earlier DataSize always displays 8 and so is useless to me as I need to be able to pin point the problem field.



I don't think you can get any more info for float fields.
TFloatField.Size = 0 (Always!!)
TFloatField.DataSize = 8

However, there is also a numeric field type called TBCDField.
TBCDField.Size = Number of digits AFTER decimal point.
TBCDField.DataSize = 34

In your example you say MyField is of type F.  Type F is type "Formatted Memo."  What version of Delphi & Database Desktop are you using?  I'm using DB Desktop 7 with Paradox 7, and Delphi 3.



            I am using dBase tables and so F is a Float Field not a Memo. But yeh I thought as much with regards to a Float Field which is why I am impressed with DB Desktop as it is able to display the field structures with the correct field size and decimal places. I would have put money on that there was a work around but it seems I have come up with a blank. I am also using Delphi 3 and DB Desktop 7 . I have exhausted the help but there is nothing really specific to my problem. The same in Books I have purchased relating to Delphi 3. Surely if DB Desktop can do it then it must be able to be done. Very frustrating.
Anyway I hope someone may know the answer to the problem and so I am going to bump
the points up a little more as it seems to be a goodun.

Hi Westy

The DB Desktop must be using the BDE API.  This file is bde.int, and can be found in Delphi\Doc directory.

DB Desktop probably uses the call DbiGetFieldDescs, which returns a FLDDesc structure.  I think your info may be in the iUnits1 or iUnits2 part of the FLDDesc.

I will play around with DbiGetFieldDescs, and if I come up with anything I will let you know.



            Yeh I was going to say before that I have already had a look in the old dbiprocs.int
file from delphi 1 to see if that could shed any light on it but drew a blank also. But your suggestion about the bde.int file sounds very interesting and I will look at it also to see if I can resolve anything. Looks like I may be closer after all.

Yes. JB is right, the iUnits2 showsthe number of digits after the point. I allready have  a source code. If JB won't find the solution for you, I'll post it later.



         Yeh no worries, I have had a decent look at the bde.int file and have been able to implement the code in my app. but it will just take a little mucking around to get it working
error free. But if you already have source code written to do a similar thing post it if JimBob hasn't been able to find a solution. Will be happy to award points to both.

OK, let me know when you want it to be posted.

Hey this is WESTY here. I have had a bit of trouble trying to LOG ON with westy so I have set up another registered name boabyte. Now with regards to the problems I have listed above I have solved it thanks to JimBob and pointing me towards the bde.int file. Thanks
JimBob I have it working well now in my APP and have only got to write changes to a table now but the hard part is done. If you lock the question (JimBob) I will award you the points. Thanks very much.

This one is on us!
(Get your first solution completely free - no credit card required)

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.