How can I read dbf that contain memo file?
Closed this issue · 14 comments
I need to read a dbf but it wont work because I have and .fpt file with it. You know how to help me with that and read the archive for opening the dbf?
I have tried with memo_file but not work too. https://github.com/emmanuelmillionaer/node-memo-parser
You could try adding support for memo fields. The source code has a couple of URLs at the top pointing to file format specifications. I won't be adding it anytime soon as I'm busy with other projects.
Did you have some recommendation to me on how to do that until the project has this support?
Hi @raulvictorrosa I've made some updates to this library recently, but I haven't found enough info to implement memo support, and I need to move on to other things for now.
Probably the first step would be to find an open-source implementation in some other language that can used as a reference to port across to this library.
@raulvictorrosa sorry, I missed the link on your OP comment. That might be enough info to implement memo support here. Just need the time now....
@raulvictorrosa I've added experimental support for reading dbf files with memos. However it will probably need more work to support your case, since you mention an .fpt
file extension which I guess is FoxBase? It seems there are differences between .dbt
and .fpt
file formats, but I only had a .dbt
fixture to experiment with.
If you have a .fpt
file I can look at and add to the test fixtures, that would help. Otherwise you could look at the latest source code and see if you can tweak it to work with your files (PR welcome).
Yes, I have the pait, .dbf
and .fpt
they are used together to open .dbf
.
Visual Foxpro 9 memo file support would be very nice for me as well.
I will see if I can get it to work, but have just started working with node. I have attached a zip file containing test.dbf and its memo file test.fpt created with Visual FoxPro 9 for your testing as well.
With a few changes, I have it opening and reading Visual FoxPro (VFP) 9 tables with memos without giving an error. I do not have it reading the values from the memo field as yet.
Information in fpt files can be found at http://www.independent-software.com/dbase-dbf-dbt-file-format.html
The changes I made are as follows (not submitting a commit due to not working completely)..
field-descriptor.js - VFP memo field has a 'size' of 4 (line 32)
dbf-file.js - Added 0x30 to the check for valid file version (line 64)
Added 'if' to use '.fpt' as memo file extension if version is 0x30, else use '.dbt'
Added 'else if (dbf._version === 0x30)' block to 'readRecordsFromDBF' function
after the 'else if (dbf._version === 0x8b)' block (line 330) to avoid
'unsupported' message.
@tiredoftry I tried to reproduce your solution based on your pseudo code but I still get 0 records for DBF file having FPT memo file. I need to read DBFs v0x30 having memo fields but I don't care about the contents and you solution would be of a huge help for me! Can you please make a branch with your solution?
I don't have it working where some files have a memo file and some don't. I will look at it more tonight and see if I can get it working reliably.
@dimitarhristovfluke . Question - you said you don't care about the contents. With this, you mean you need the contents of the DBF file, but not the FPT (memo), correct?
correct. And I was actually made it working now - able to read with or without fpt file (i.e no memo fields in the table). But I have no access to submit branches in this repo.
Good to know. I have a bit of time this morning to look at it as well and have a start on reading memo's from FPT tables. When I getting it working, I will see if I can submit a branch, but if not, I will document all my changes in detail here.
Closing this issue as it's pretty old and stale now.
@dimitarhristovfluke @tiredoftry if you have any updates on this, please open a new issue or PR.