Bug 108845 - pasting data from a CSV file didn't work properly: only a single row
Summary: pasting data from a CSV file didn't work properly: only a single row
Status: RESOLVED INVALID
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
5.3.3.2 release
Hardware: x86 (IA32) Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-28 22:15 UTC by jsc67
Modified: 2022-04-22 12:55 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
CSV file with dummy patient data (2.64 KB, text/plain)
2017-07-05 14:33 UTC, jsc67
Details
Base file with a single table so far (3.24 KB, application/vnd.sun.xml.base)
2017-07-05 14:35 UTC, jsc67
Details
screen shot immediately after pasting all selected data (53.37 KB, image/png)
2017-07-10 14:24 UTC, jsc67
Details
screen shot after pasting, then changing focus to accept entry (52.11 KB, image/png)
2017-07-10 14:25 UTC, jsc67
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jsc67 2017-06-28 22:15:19 UTC
Description:
As per "https://help.libreoffice.org/Common/Importing_and_Exporting_Data_in_Base" I created a table with 3 fields, opened a CSV with 3 fields, selected all the data in the CSV file, then went to paste the data into the Base field. There should have been 10 records, but only a single row was created. When I clicked outside this row to accept it, I got a popup error message saying, "Error inserting the new record Value too long in statement [INSERT INTO "demographics" ("SEXF") VALUES (?)]".

Steps to Reproduce:
1.Put cursor in row to be pasted into,
2. Got to Edit, select Paste,
3. Undo things so that I can move on.

Actual Results:  
Cannot paste a table of selected data from CSV into a new Base table. I wish I could send a screenshot, or the CSV file (only 10 records in it) for more clarity.

Expected Results:
The bug is reproducible.  If there's a trick to pasting data into Base, then the documentation needs to say how to do so more clearly.  Otherwise, it looks as if this simple task just doesn't work as described, and that to me is the essence of a bug.


Reproducible: Always

User Profile Reset: No

Additional Info:


User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0
Comment 1 Robert Großkopf 2017-06-29 14:09:15 UTC
(In reply to jsc67 from comment #0)
> When I
> clicked outside this row to accept it, I got a popup error message saying,
> "Error inserting the new record Value too long in statement [INSERT INTO
> "demographics" ("SEXF") VALUES (?)]".

Without the database and the *.csv-file added here as attachment I could only have a look at the message. Seems there is a value in the *.csv-file, which couldn't be saved in the database-table, because the field of the database-table could only save shorter values.
Comment 2 Buovjaga 2017-06-29 14:24:19 UTC
(In reply to jsc67 from comment #0) 
> Cannot paste a table of selected data from CSV into a new Base table. I wish
> I could send a screenshot, or the CSV file (only 10 records in it) for more
> clarity.

You can attach it to your bug report. If it contains sensitive data, save a version with bogus data and confirm the problem still exists for you before uploading.
Comment 3 Alex Thurgood 2017-06-30 07:20:22 UTC
@jsc67 : as Robert has indicated, the paste operation fails because Base thinks that one of the values that you are attempting to insert from the CSV into a given field (SEXF) is too long for the definition in your ODB table.

Without a test ODB file, and a corresponding CSV file with data in to test the copy/paste mechanism, we are just clutching at straws.

As buovjaga has mentioned, you can attach files to the bug report using the "Add an attachment" link.

Setting to NEEDINFO pending requested information. Please set back to UNCONFIRMED once you have provided the requested files.
Comment 4 jsc67 2017-07-05 14:33:10 UTC
Created attachment 134493 [details]
CSV file with dummy patient data

This file is a spreadsheet containing (dummy) patient information that should be linked by ID.  There are 3 groups of columns of 3  sorts of patient data, each of which originally came from a different CSV file; I just put them all together for ease and wanted to copy them to some Base tables and then make links.  I tried to copy and paste the smallest one first (10 records, right hand side).  As I tried to communicate in the bug report, when pasting everything got put together into a single record, and not 10 records as in the spreadsheet.  When clicking outside the pasted record to change it, it failed.  I did not save the changes.  I'll upload the Base file shortly too.
Comment 5 jsc67 2017-07-05 14:35:01 UTC
Created attachment 134494 [details]
Base file with a single table so far

This is the Base file with the table into which I wanted to paste the selected data from the CSV file as per online instructions for pasting data into tables.
Comment 6 jsc67 2017-07-05 14:35:42 UTC
Sorry, I overlooked the Attachments link before.  Thank-you for your replies.
Comment 7 Alex Thurgood 2017-07-05 16:53:11 UTC
@jsc67 : thanks for the information.

However, your CSV file doesn't appear to be in a format that can be recognized correctly by Base.

The first line contains multiple occurrences of ,, (double comma). Base is incapable of interpreting this.

It takes the first line as the column names, wherein each field name is separated by a single comma. If you include two commas, Base can not index that data stream against the field definitions in your ODB file.

The same goes for your values. You need to separate your data back out into 3 different CSV files again, and then try importing them separately; or else tidy up your single CSV file so that all of the data can be imported correctly.
Comment 8 Alex Thurgood 2017-07-05 17:00:34 UTC
If I take your Study/Weight/SexF data and copy it to a new Calc sheet, then select all of the data (including first line) and drag it onto your demographics table, the data get's inserted correctly (apart from having a blank 0 value set as the tuple).
Comment 9 jsc67 2017-07-10 14:24:21 UTC
Created attachment 134574 [details]
screen shot immediately after pasting all selected data
Comment 10 jsc67 2017-07-10 14:25:38 UTC
Created attachment 134575 [details]
screen shot after pasting, then changing focus to accept entry
Comment 11 jsc67 2017-07-10 14:27:45 UTC
(In reply to Alex Thurgood from comment #8)
> If I take your Study/Weight/SexF data and copy it to a new Calc sheet, then
> select all of the data (including first line) and drag it onto your
> demographics table, the data get's inserted correctly (apart from having a
> blank 0 value set as the tuple).

No, it doesn't.  Not as I do it.  How *exactly* are you doing this?  I wish you could send a video.  When I copy all the data and then click in the first row and try to insert all the data, I get only a single record inserted, and it tries to insert all the data into a single record instead of giving me 10 records.  Do yo get 10 records when you insert?  The bug remains as far as I'm concerned.
Comment 12 Robert Großkopf 2017-07-10 15:10:19 UTC
You try to paste data in one row.
1) Close the table.
2) Right mouseclick on the table.
3) Select "Paste" and follow the wizard (Append Data > ...)

Could be you get another problem. You have defined a field WTKG as NUMERIC without decimal places. When I open the *.csv-file I see 2 decimal places ...
Comment 13 Alex Thurgood 2017-07-10 15:23:19 UTC
(In reply to jsc67 from comment #11)


> 
> No, it doesn't.  Not as I do it.  How *exactly* are you doing this?  I wish
> you could send a video.  When I copy all the data and then click in the
> first row and try to insert all the data, I get only a single record
> inserted, and it tries to insert all the data into a single record instead
> of giving me 10 records.  Do yo get 10 records when you insert?  The bug
> remains as far as I'm concerned.


Either as Robert has indicated (using Copy/Paste shortcuts) or as I do it :
1) Select the data to be copied
2) Drag the selection onto the table of your choice in the Table list (i.e. the list of tables that you see when you click on the Tables icon after opening your ODB file. You do not need to have any particular table open in data entry mode. The data import assistant will start and ask you whether you want to just append the data, both data and field definitions, or just the field definitions. Note that the data import wizard is far from perfect so on occasion, and depending on the type of data and the table/field definition, misinterpret the copied data and either fail to complete or else screw up the insert of the data. Most of those bad behavioural bugs are already known and reported in this bugzilla.


If you need a video:

https://www.youtube.com/watch?v=D_W-FAT3XE4
Comment 14 jsc67 2017-07-11 02:12:36 UTC
Robert, Alex: thank-you.  The video on YouTube is much clearer than the LibreOffice instructions were.
Comment 15 Gowit 2022-04-22 12:55:05 UTC
Any time of the day you can commit to exercising is a good time for getting active https://dltutuapp.com/tutuapp-download/
https://showbox.run/