yortus/DBFFile

Numeric with decimalPlaces

blue-predator opened this issue · 5 comments

When amount has decimal places for example 175,50 the created dbf file is empty, if the amount is 175.00 the file is not empty.

Tried
{ name: 'amount', type: 'N', size: 19 },
{ name: 'amount', type: 'N', size: 19, decimalPlaces: 2 },

Thanks for the bug report @blue-predator. I don't think there's enough information in the issue description to investigate this. Are you able to supply detailed steps to reproduce the problem, eg a code snippet that demonstrates the error?

@yortus Sorry let me try to give more information and some snippets from my code.
I using NodeJS v14.17.5 for the API with "dbffile": "^1.8.0",
No error message is generated

The file structure looks like:
image

The json body contains:
image

For creating the DBF file or appending a new record:
image

The DBF file is created, but the record is blanc:
image

Hope this is enough information, if not don't hesitate to ask for more.

As a workaround I tried changing type N to type C, but then I notice that if I send 175,50 multiple times it works, if I send 175,50 once and then 175,00 it does not work any more.
It's the same if I send 175,00 once and then 175,50

I notice if I send "bedrag" value as string this behavior is not the case, but decimalPlaces does not have any effect.
{
"bedrag": 175,50 - does not work
}

{
"bedrag": "175,50" - works, but decimalPlaces does not
}

I'll need a code listing that I can run and debug in order to investigate this. There are a number of possibilities that I can't really check just from looking at the info above. Are you able to put together a small repro?

Closing as inactive - feel free to reopen to address my previous comment so this can be further investigated.