[OpenMap Users] problems writing dbf file

From: Robert Najlis <rnajlis_at_cs.indiana.edu>
Date: Mon, 6 Sep 2004 11:17:46 -0400

I have tried a number of things, trying to simplify to get the simplest
case to work:

The simplest thing I tried was to read in the dbfModel from an
esriLayer and then just write it out again.

--------
DbfTableModel dbfModel = esriLayer.getModel();

                                dbfModel.setWritable(true);
                                 DbfOutputStream dbfOut = new DbfOutputStream(new
FileOutputStream(newDatasourceNoSHPNoDot + ".dbf"));
                             dbfOut.writeModel(dbfModel);
                             dbfOut.writeRecords(dbfModel);
                             dbfOut.close();
--------

my larger intention, and what I had originally tried, is to get a
dbfModel, modify it, and the write it to either the original, or a new
location. I am modifying the dbf file one record (row) at a time.
that is I have objects which each have a couple of pieces of data (from
some columns in the dbf) from one record. I am modifying each record.
I set the values in each of these objects from the dbf file, setting
these values into the object's field (using a set method based on the
column name). I have checked the data, and the objects were in fact
set with the data values. Furthermore, and this is where things seemed
to get strange for me, I tested the value that the record should have
been setting into the dbfModel, and it seemed correct. That is, I
called the appropriate method in the object to get the value that was
to be set in the dbfModel (dbfModel.setValueAt(...)) then I called
dbfModel.getValueAt(..) -- and I got what appeared to be the correct
value. But still, when I wrote the values out, I got zeros.

One thing which might shed some light, or at least appeared strange to
me (but this may be how things are supposed to work) : The values in
the dbf file appears as what would make sense to be integeres
(4,5,6,etc). But the values that I get back from the dbf model are
double (4.0, 5.0, 6.0, etc.0). I don't know if this affects anything.

Thanks a lot for your help (and on a holiday no less).

Robert





>
>
> On Sep 6, 2004, at 10:34 AM, Don Dietrick wrote:
>
>>
>> On Sep 5, 2004, at 9:10 PM, Robert Najlis wrote:
>>> I am changing the folder location of the dbf file (moved it from the
>>> original location). I don't know if this would cause any trouble.
>>
>> Can you explain a little more what you are doing here? This sounds
>> significant in your problem, seeing as you are getting a bad file
>> descriptor IOException.
>>
>> - Don
>>
>>
>> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>> Don Dietrick, dietrick_at_bbn.com
>> BBN Technologies, Cambridge, MA
>> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>>
>> --
>> [To unsubscribe to this list send an email to "majdart_at_bbn.com"
>> with the following text in the BODY of the message "unsubscribe
>> openmap-users"]
>

--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Mon Sep 06 2004 - 11:21:28 EDT

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:05 EDT