Ask Your Question
0

Importing CSV adding default values

asked 2016-07-30 17:46:45 +0200

samwise1988 gravatar image

Hello,

I have designed a table so that fields match a third party generated .csv and importing this all works fine. I've also managed to add an extra field (which isn't in the .csv) as a primary key which auto generates an integer which is great. What I am having trouble with is that I would now like to add a boolean field (a required field with default value of No). After adding this field the data fails to import as the .csv does not have data that corresponds to this boolean field and Base tells me I cannot enter a null value (as I've set it to be required). Interestingly if I add data manually into the table then the boolean field will auto fill with the default value.

Is there a way to make this work??

Thanks

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2016-07-30 18:21:17 +0200

Ratslinger gravatar image

Your question doesn't mention a few things such as: split or embedded DB; one-time or on-going process; how much data?

You can set the boolean field to not required, import the data, set the boolean field with an SQL statement for all records and then turn the field back to required.

or

You can import the data to Calc, create a new column for the boolean field, enter the default and then copy the data to the table.

Either way is fairly quick.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-07-30 17:46:45 +0200

Seen: 304 times

Last updated: Jul 30 '16