ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read .dbf file correctly?

Solved!
Go to solution

Hello,

I have a file with a .dbf extension and I need to read the contents of it, but it comes with unreadable characters

I don't have access to generate this file, I only receive the file and need to read and manipulate the file's data

How can I properly read this file?

leandrofeder_0-1712856150410.png

 

0 Kudos
Message 1 of 7
(9,198 Views)

I read this data using Read Spreadsheet array , does it make sense ?

 

 

LVNinja_0-1712860970770.png 

LVNinja_1-1712861010534.png

 

 

0 Kudos
Message 2 of 7
(9,167 Views)

This is binary file, the dbf extension usually reserved for dBase:

Screenshot 2024-04-11 20.49.39.png

You should found spec for this format, read it as byte array and parse.

For example if this is dBase, then the first Byte is version, the next 3 bytes — date of last update; formatted as YYMMDD (with YY being the number of years since 1900), in your case 7B 09 0E which is decimal 123; 9; 14 - means 14 September 2023 (1900+123), the next four bytes is amount of records (it seems to be that you have attached the only small portion, or something wrong with your header/data).

Keyword in the header is DBWINUS0 - search internet you will found some viewers and specs like https://www.dbase.com/Knowledgebase/INT/db7_file_fmt.htm

 

 

0 Kudos
Message 3 of 7
(9,157 Views)

Yes, i'm doing like that
But i would to read the characteres correctly too

leandrofeder_0-1712861915641.png

 

0 Kudos
Message 4 of 7
(9,156 Views)
Solution
Accepted by leandrofeder

@leandrofeder wrote:

Yes, i'm doing like that
But i would to read the characteres correctly too

 

 


You can't read data correctly as long as you don't know how they encoded. Some text is readable:

Screenshot 2024-04-11 21.14.04.png

But the bytes sequences like DA E2 BD D5 28 E6 etc cannot be visualized as "characters" without decoding, may be here some number stored as floats/doubles, may be something else. Again, it is binary and not text format.

0 Kudos
Message 5 of 7
(9,148 Views)

I have no idea if it's any good (or even secure), but i found: DBF Viewer | dbfviewer.com

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 7
(9,110 Views)

Install a dBase database driver (dBase ODBC Driver?) and a SQL library (LabSQL, or Database Connectivity Toolkit Download).

 

Use either ODBC or figure out a connection string to the file.

 

Next, learn some SQL and query the database the way it was designed to be done.

 

Alternatively, convert the dBase file to a modern database (like MySQL: Convert DBase to MySQL online - RebaseData).

0 Kudos
Message 7 of 7
(9,102 Views)