Solved

Help : Delphi 3.0 Floating Point Types

Posted on 1998-05-18
12
291 Views
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,
WESTY
0
Comment
Question by:westy100697
  • 5
  • 4
  • 2
  • +1
12 Comments
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1346077
Hi

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."

Regards,
JB
0
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1346078
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."

Cheers,
JB
0
 

Author Comment

by:westy100697
ID: 1346079
JimBob,
            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.

Regards,

WESTY
0
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1346080
Hi

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.

JB
0
 

Author Comment

by:westy100697
ID: 1346081
JimBob,
            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.

Cheers
WESTY
0
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1346082
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.

Cheers,
JB
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:westy100697
ID: 1346083
JimBob,
            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.

Thanks.
WESTY
0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1346084
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.

Ronit
0
 

Author Comment

by:westy100697
ID: 1346085
Ronit,
         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.

WESTY
0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1346086
OK, let me know when you want it to be posted.
0
 

Expert Comment

by:boabyte
ID: 1346087
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.

Regards
WESTY
0
 
LVL 5

Accepted Solution

by:
JimBob091197 earned 300 total points
ID: 1346088
Hi Westy/boabyte

Glad you got it working.  Nothing like a little perseverance!!

Cheers,
JB
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now