Ask Your Question
0

[Base] Linked Table from CSV

asked 2017-04-10 02:05:11 +0200

wquatan gravatar image

I have an ODB with a table which is an external (linked-to) CSV-file.

I can't find a way to force the Field-Type settings to be used for that file. I have a problem with the Field-type determination.

For a certain column, the content may be numeric or text Example OK: When for that column in row 4 its text, the field-type is Text[VARCHAR] OK: When for that column in row 10 its text, the field-type is Text[VARCHAR] NOK: When for that column in row 270 its text, the field-type is Decimal[DECIMAL] NOK: When for that column the rows 3301-3310 are text, the field-type is Decimal[DECIMAL]

As a result, in the last two examples, text-values get lost

How can I force the Field-Type ?

edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted
1

answered 2017-04-11 08:59:35 +0200

pierre-yves samyn gravatar image

Hi

I had written a FAQ about it. It shows how to create the table structure and link the data file.

Maybe that will help you?

Regards

edit flag offensive delete link more

Comments

@pierre-yves samyn Thank you much for the link. I would never have known without this. Don't know if I would ever use but good to have in toolbox.

Ratslinger gravatar imageRatslinger ( 2017-04-11 16:56:06 +0200 )edit

Thank you !

I didn't use SQL to link to a CSV probably the reason why I wasn't able to modify the Field-Types (Field-Names / Types generated automatically, Names upon line 1)

I think your example will do what I need.

Is there a way to skip the first line in the linked-csv ?. Mine has fieldnames (generated by the source application) in the first row. For fields defined as Numeric, line 1 of course generates an error

wquatan gravatar imagewquatan ( 2017-04-17 12:24:27 +0200 )edit
0

answered 2017-04-10 02:52:37 +0200

Ratslinger gravatar image

A field (column) in a table can only be of one type. It cannot be defined as different types depending upon the row. All data can be in a text field (varchar) and then dealt with from there.

Not sure what you mean by linked-to CSV file. You can CREATE a table (read only) from a CSV file but it is not really linked. The data cannot be modified in any way.

edit flag offensive delete link more

Comments

My question was misunderstood. I know very well the type is the same for a column, but the problem is that the type determined automatically for the column concerned isn't correct --> see examples

With linked-to CSV is was indicating that the data of the table are stored in an external CSV-file (and not imported from a CSV-file)

wquatan gravatar imagewquatan ( 2017-04-10 09:47:18 +0200 )edit

Having worked with Base for a few years, I know of no way to "Link" to a CSV file. If you know of a way could you please explain.

Ratslinger gravatar imageRatslinger ( 2017-04-10 14:42:37 +0200 )edit

Till now I have been using : New --> Database --> Select "Connect to an exsisting Database" --> Choose for "Text" It's more flexible and easier then via SQL, but with the problem I described in the start of this Topic

wquatan gravatar imagewquatan ( 2017-04-17 16:19:34 +0200 )edit
0

answered 2017-04-23 01:16:26 +0200

wquatan gravatar image

@pierre-yves samyn I think your example will do what I need.

Is there a way to skip the first line in the linked-csv ?. Mine has fieldnames (generated by the source application) in the first row. For fields defined as Numeric, line 1 of course generates an error

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-04-10 02:05:11 +0200

Seen: 524 times

Last updated: Apr 23 '17