Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Numeric format in Btrieve? 1

Status
Not open for further replies.

plan19

Programmer
Jan 26, 2011
2
US
I'm ready to admit that I'm pretty much lost.

I'm working on a report for a friend so that they can get functionality the vendor does not provide.... basically something so that they can see a particular customer's order history for the last period as compared to the same period last year... so they can maintain appropriate inventory levels.

No DDFs, no help from the vendor. I've used DataTools with great success... but now I'm stuck.

For any given invoice, all line items are stored in a single variable-length field. Each line item record itself is 35 bytes in length. I know that the item number is ten digits, and proceeded by 00 80 3f f0 or 00 80 3f f8... not sure the significance of that...

What I'm trying to figure out is... I KNOW the quantity for each line item is 32 bits long. I know that if I look at the quantity 1, it will be 10 27 00 00. I initially thought that the first byte was my first significant digit, but that theory goes out the door after 16.

I also reasoned that the second third byte had to do with how many times the number could be evenly divided by 7, but that pattern, too, eventually goes out the window.

If anybody has any ideas... I would gladly owe you a beer... because I'm stuck.

Pervasive/BTRIEVE is not my strong point.. and I'm sure that my modern rdbms-spoiled-self is missing something.

I just don't know what.

Help?
 
It sounds like the quantity is not stored as an integer but possibly as a decimal or numeric or even a custom format the developer of the application uses. You posted the quantity 1 as 10 27 00 00 (this maps to 10,000 in decimal). What is the value of the quantity 2? Is it 20 4E 00 00 (this is 20,000)? What application is used to populate the data?

Here's a pretty good description of all of the Btrieve key types including how the bytes are structured for each one:

Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
 
You, sir, are brilliant.

I actually put a link in my post to a sample of the data, but you nailed it without it... my hat is off to you.

I don't know why I didn't see it... but now I see it is because I was working forward from the data I was expecting, rather than backward from the data I had. I was expecting 1 to be 01 00 00 00, rather than 10 27 00 00. I even went to the trouble of writing a little utility to convert a number input into different packed formats... short/long/int/double... when what I should have done is written it to convert a hex input into different unpacked formats.

The dangers of spinning your wheels, I suppose.

Thank you.
 
Thanks for the star. Glad you got it all figured out. Because I've worked with Btrieve / PSQL for over 15 yrs, I've seen all kinds of data types and data type algorithms. I was just lucky with your data.


Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top