Skip to content

Error creating dbf when Integer fields are defined. #53

@JosepMariaGomez

Description

@JosepMariaGomez

Error on read dbf files created with jdbf if there is one (or more) field of Integer type.

            String fieldsInfo = "CODE,C,12,0|TITLE,C,40,0|CATEGORY,I,5,0";
            DbfMetadata meta1 = DbfMetadataUtils.fromFieldsString(fieldsInfo);
            meta1.setType(DbfFileTypeEnum.FoxBASEPlus1);
            DbfWriter writer = new DbfWriter(meta1, out);  // out is a OutputStream to send the file to the client side.
            writer.setStringCharset(Charset.forName("ISO-8859-1")); // ISO-LATIN-1
            Map<String, Object> map = new HashMap<>();
            map.put("CODE", "1");
            map.put("TITLE", "FIRST");
            map.put("CATEGORY", 1);
            writer.write(map);
            writer.close();

No error is raised during creation process.

           String fieldsInfo = "CODE,C,12,0|TITLE,C,40,0|CATEGORY,N,5,0";

Changing the definition to N, converts the field to Float, and dbf file can be readed (with an external dbf browser).

Many thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions