Comments (7)
My solution:
DbfRecors.java
public Map<String, Object> toMap() throws ParseException {
Map<String, Object> map = new LinkedHashMap<String, Object>(getFields().size() * 2);
for (DbfField f : getFields()) {
String name = f.getName();
switch (f.getType()) {
case Character:
map.put(name, getString(name));
break;
case Date:
map.put(name, getDate(name));
break;
case Numeric:
map.put(name, getBigDecimal(name));
break;
case Float:
map.put(name, getBigDecimal(name));
break;
case Logical:
map.put(name, getBoolean(name));
break;
case Integer:
map.put(name, getInteger(name));
break;
}
}
return map;
}
meta.getFieldsStringRepresentation() = TARGET_FID,N,9,0|nummer,C,12,0|k_superfic,F,19,11|Nome_zone_,C,12,0
rec.toMap = {TARGET_FID=327284, nummer=315,k_superfic=23.897, Nome_zone_=RE
from jdbf.
Any chance you'd be willing to share your test file? We just added a dbf parser on Apache Tika and we need examples of Float fields.
from jdbf.
Hi, Paolo and friends.
I have similar interests: reading (and writing) DBF files. I am also having issues with reading (and writing) numeric fields (not exactly Float, but Double and Integer --as known in xBase languages--).
Specifically wih Float fields I am not having issues: I added routines to the original script and I am getting correct results: reading and writing them.
I consider that we could share info with this respect. I know the zorro language well.
Let me know how we can proceed. You can get me as jhernancanom.
I am in hotmail.
HERNAN CANO M
Systems Analyst
from jdbf.
Hi Hernan,
Any chance you could share a test file? We'd want to fix this over on Apache Tika as well. Thank you!
from jdbf.
@paoloromani Could you please share your DBF file ?
from jdbf.
Hi, friends.
I am attaching my sample DBF.
- The DBF is file aked by you (SAMPLE_2_DBF.txt, take off the TXT extension, and put DBF).
- The STR is the structure as Fox shows us (SAMPLE_2_.TXT).
- The PNG is an image about how Fox shows us.
Notes:
The file has the basic type of fields that an xBase engine manages: Character (that is to say String), Logical (that is to say Boolean), Numeric (both integers and reals--with decimals--), and Date.
I also have incorporated two Float fields according to your asking; one has decimals and another without decimals.
I wait this can help you.
I'll start with my needs.
The very basic field for numeric data in xBase is Numeric that can be defined to have decimals or not.
Later the xBase dialects add some more numerical types: Float, Double, Integer and Currency.
I have attached a .DOC file that shows some features of field types.
For example: Float is the same as Numeric. Integer is 4 bytes long when saved in a DBF file. If the precision of Double type and Float type is the same, and Double has a broad range, then it means that Double must be encrypted/converted to allocate correctly (and also for Integer type).
SAMPLE_2_DBF.txt
Based on this I consider that our script should be correct: if you can get a Numeric value in your Java with getBigDecimal, that it could be used for getting a Float (Fox dialect).
If you need any more, you can write.
Thanks, friends.
HERNAN C
from jdbf.
@jhernancanom Thanks a lot, I started looking into it. Will put updates here.
from jdbf.
Related Issues (20)
- DbfReader GetString(fieldname) or GetBytes(fieldname) Return Incorrect Value HOT 1
- Error reading memo fields HOT 1
- Better diagnostic of corrupted files HOT 3
- Java SE 6 compliance HOT 1
- Cannot open Generated DBF file in Visual fox Pro HOT 1
- dBASE Level 7
- to change the scope of the method getInteger to public HOT 2
- Doesn't work with my .dbf files
- MemoReader.read() method reading from wrong location HOT 5
- Compilation failure HOT 1
- the date of last update which store in 1-3bytes of DBF file is incrorect
- Problem reading Double solved HOT 1
- Character length HOT 1
- Dbeaver
- i am getting 'E' values instead of double numbers
- Incorrect file date. HOT 1
- Error creating dbf when Integer fields are defined.
- Cannot open dbf generated from net.iryndin.jdbf.TestDbfWriter
- Dead loop in JDK1.8 when DBF file size is over Integer.MAX_VALUE(2^31 - 1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jdbf.