Export CSV | not able to read delimited fields correctly

** Sorry, I could not post images inline

Hello,

I am using codebook 4.5.19 to export in the csv format. I’ve created a record, Item 1, with multiple note fields. One note field value is Item 2

I’m having trouble where Item 2 is returned as two password fields.

The “note” CSV column value is item 3.

You can see Item 2 returned Item 4 with the backslash escaped. This leaves a bare pipe that delimits multiple field values of the same field type.

Can you please tell me if and how the string is parsed to recognize Item 2 as one field?

Hi @evan2048 ,
Thanks for reaching out to us on discuss. The format updates you are looking for should be located here: Codebook Help - Import . If you run into any other issues, please reach out to us at support@zetetic.net

Regards,
Don

Hi @evan2048,

In addition to the documentation link Don provided, I thought I might try to provide some tips here and try to get a little clarification on your situation, in case you are seeing some bug that we aren’t yet aware of.

First, if you are doing a round-trip of your database using CSV format, from export to import, you should be aware that the import won’t set everything up exactly the same as you had it before. For instance, you may see that some fields on entries aren’t in the order you expect – that’s a limitation of the CSV format. If you are doing this to test a backup and restoration strategy, we would recommend restoring your data via the sync feature instead.

With that out of the way, on to the situation with the pipes!

When there is more than one field on an Entry with the same label, e.g. Password, on export Codebook needs to put these in the same Password column of the CSV. In our Codebook CSV format (which is what Codebook for Windows uses by default), we concatenate them with a pipe | character.

password1|password2

On import of Codebook CSV, Codebook will then split that value up into two separate Password fields on your Entry.

Now, if you have a field value you are importing that you do not want to be split up this way, so a password with a pipe in it already like so:

welcome|123

Then you need to escape the | character with a backslash, like so:

welcome\|123

And then on import the resulting field value will be welcome|123 as intended.

From your post I’m having trouble understanding if what you are seeing reflects what I’ve described here. Is the backslash escape of a pipe character in your fields not working when you import with Codebook for Windows?

Hi @wgray ,

Is the backslash escape of a pipe character in your fields not working when you import with Codebook for Windows?

Good question. It does not work when importing.

( I’ve found the order fields are added using the UI affects the order they occur in the | delimited value. So your milage may vary unless you delete and re-add the values to the test entry the same way I did :slight_smile: )

This test:

exported:
image

Imports this way:

Perhaps the export did not escape the literal \ in the value and the import sees it as a meta character.

Thanks!