[Solved] Database linked csv, problem with field types

dBase, Calc, CSV, MS ACCESS, MySQL, PostgrSQL, OTHER
Post Reply
blah_blah_blah
Posts: 8
Joined: Mon Feb 22, 2016 1:21 am

[Solved] Database linked csv, problem with field types

Post by blah_blah_blah »

Hi there.

I have a base file linked to a directory of csv files.

My problem is, I can't seem to change how the fields are read in the database.

I've read somewhere that they are decided on by reading the second line of the csv (after the headers) and then whatever datatype is present in the column will decide the field type for the whole column.

I've done some testing with this and it looks like I'm getting random results with how the data is read. I want the data as a number type so I can make a SUM with the column when imported to calc. however quite often the data is read as a TEXT field and causes problems.

the csv file is updated daily from the internet hence the csv directory structure.

Any help would be appreciated.
Last edited by Hagar Delest on Wed Jun 01, 2016 10:37 pm, edited 1 time in total.
Reason: tagged [Solved].
Llibreoffice 4.3 on Debian Linux
User avatar
RoryOF
Moderator
Posts: 34570
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: database linked csv, problem with field types

Post by RoryOF »

A small sample file would help.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
User avatar
Villeroy
Volunteer
Posts: 31264
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: database linked csv, problem with field types

Post by Villeroy »

The text driver for Base has not enough import options to meet common requirements. It works fine with unquoted numbers and all numerals according to the global setting. You can set the decimal separator independently from any locale but "special numbers" (mostly dates, times, booleans)" are interpreted in the global locale context.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
blah_blah_blah
Posts: 8
Joined: Mon Feb 22, 2016 1:21 am

Re: database linked csv, problem with field types

Post by blah_blah_blah »

Thanks for the help,

I ended up going with what is explained in
viewtopic.php?f=83&t=23260
Llibreoffice 4.3 on Debian Linux
Post Reply