CSV Import of private_id
-
When I import records using the CSV Import function no Private IDs are generated for the imported records, so I decided to generated my own 7 digit random alpha-numeric strings (for example “C40TCWE” and “73YSN1A”) in LibreOffice Calc, but when I import records including this field (private_id) it just ends up being blank, even though the others fields imported properly. What am I doing wrong?
-
Are you using the latest version of the plugin? I’ve just tested this and I was unable duplicate your result.
Importing a new record with a blank private ID generates a new private id for the record.
Importing a new record with a private ID value uses the provided private ID value.
Importing a record with an id that matches an existing record updates the matching record with the provided private ID.
Can you go into a little more detail about your CSV? What fields were included? Have you tried testing the import with plugin debugging on? If so, did you see any issues in the debugging log?
-
This reply was modified 2 years, 8 months ago by
xnau webdesign.
-
This reply was modified 2 years, 8 months ago by
xnau webdesign.
1.) Thanks for your help and suggestions! Yes, I am using the latest version of the plugin, 2.1.8, and it’s set to auto-update. There are no other plugins active, by the way.
2.) My “test.csv” import file consists of one line and was created and edited in Gedit on Fedora Linux and saved in UTF8 format.
3.) In my testing this morning I am getting the opposite results of my testing yesterday evening! Today ONLY the private_id is being imported or generated, whereas yesterday everything EXCEPT the private_id was being imported and no private_id was being generated if left blank. Your explanation of what SHOULD happen in each of these cases was helpful.
4.) This morning I tried importing several test csv files with “CSV Imports in the Background” turned on, which is the default setting. In each case, no provided private_id, a provided unique private_id, and a provided repeat private_id, the personal_id was handled correctly but the rest of the new record was blank.
Here is the debugging report:
[07/21/22 6:03pm UTC]
xnau_CSV_Import::insert_from_csvcolumns:day_id, month_name, day_number, private_id
csv line= Array
(
[day_id] => 01-19
[month_name] => January
[day_number] => 19
[private_id] => BN34MK2 <== Note: This is a private_id that I generated and which already exists in the database.
)
[07/21/22 6:03pm UTC]
CSV import: empty column skipped: day_id
[07/21/22 6:03pm UTC]
CSV import: empty column skipped: month_name
[07/21/22 6:03pm UTC]
CSV import: empty column skipped: day_numberNote: These three fields should NOT have been skipped! This may indicate a bug in your code.
[07/21/22 6:03pm UTC]
PDb_submission\main_query\base_query::execute_query storing record: INSERT INTO wp_participants_database SETdate_recorded
= “2022-07-21 18:03:45”,date_updated
= “2022-07-21 18:03:45”,approved
= ‘no’,private_id
= ‘Q43NOM3’ <== Note: This is a new private_id that was generated automatically by the plugin, correctly.Note: As you can see, no data was imported, but a new private_id was generated, resulting in a new blank record except for the private_id field along with the date_recorded, date_updated, and approved fields.
5.) After running all of the above tests, I tried it again with “CSV Imports in the Background” turned off. In each test case, no provided private_id, a provided unique private_id, and a provided repeat private_id, the personal_id was handled correctly and the rest of the data fields were imported correctly. In other words, it worked flawlessly.
Here is the relevant debugging report:
07/21/22 6:43pm UTC]
xnau_CSV_Import::insert_from_csvcolumns:day_id, month_name, day_number, private_id
csv line= Array
(
[day_id] => 01-19
[month_name] => January
[day_number] => 19
[private_id] => 123RT45 <== Note: This is a private_id that I generated and which already exists in the database.
)
[07/21/22 6:43pm UTC]
PDb_submission\main_query\base_query::execute_query storing record: INSERT INTO wp_participants_database SETdate_recorded
= “2022-07-21 18:43:55”,date_updated
= “2022-07-21 18:43:55”,day_id
= ’01-19′,month_name
= ‘January’,day_number
= ’19’,approved
= ‘no’,private_id
= ‘ATOHEP6’ <== Note: This is a new private_id that was generated automatically by the plugin, correctly.Note: As you can see, none of the import data fields were skipped as they were with “CSV Imports in the Background” turned on.
6.) Conclusions:
In my case, “CSV Imports in the Background” causes problems. Yesterday, it always created new records missing a private_id and today it always created new records missing everything except a private_id. One possible explanation for this discrepancy is that yesterday I was creating test.csv files with multiple records whereas today I used only single record test files. I will have to investigate that further and see if I can recreate yesterday’s results by using multi-record import files.
I am not aware of any caching software running in my WordPress installation or on my hosting service, Hostinger.com, but there could be any number of things happening on the back-end that I have no knowledge of or control over.
What do you think is going on?
Probably caching, but this is a guess. The background import does see problems on some systems, but I have been unable to identify the specific reason for this.
Most hosting providers use some level of server caching, saves them money on bandwidth, whether that is the problem ot not, I don’t know.
I’m going to check on those “empty column skipped” items, thanks for showing that to me.
Also, if the private ID provided in the import matches an existing on, it will be regenerated, to make sure it is unique.
Generally speaking, you should not import/export private ids, just let the plugin manage them.
-
This reply was modified 2 years, 8 months ago by
- The topic ‘CSV Import of private_id’ is closed to new replies.