Imported Data Shows Numbers Instead Of Text

Hello,
I am uploading a CSV to my live database, and some data marked as “TEXT” would still show up as “Numbers”, even when I’ve mapped them correctly, and even confirmed at the preview stages that they should’ve been “TEXT”. See attached image - lines 29 and 30 are new data, and lines 31 and 32 are existing data, which have no issues. Help?

Hello,

I tried to recreate the described scenario - the importing process seems to be working correctly for me.

  1. This article contains detailed information about the importing data - you might find it helpful: https://support.wix.com/en/article/how-to-import-collection-data-in-the-content-manager

  2. Could you please share more details?

  • If I understand correctly, you are importing the “problematic” values into an existing column. Could you please share its properties? ( Column title → Manage Properties )
  • Can you share the CSV file (or its part ) causing the issue?
  • Also, what is your site URL?

Alexander

Hi Alex,

Thanks for the response. Here’s the step-by-step process, from preparing CSV file for upload:


Note here that I have tried to format the problematic columns (columns F and T) in the CSV file to set them as text/general/etc., and it did not help with the problem.

Next, importing this CSV file to my live database:


Preview looks correct here:


Next step also showing that the field would be imported as text:


After import, problem appears:


My url is www.diversify.space
Currently I have manually converted all the problematic cells to text in order for my search function to work, but I have more data to be uploaded, and this problem needs to be resolved.

Current property of my “Year” field is text (field type). I can’t screen capture this, but take my word for it.
If you would like my csv file, please let me know how I can attach it.

Help is appreciated.

Hi halfnhalfproduction,

Thanks you for the details - I was able to reproduce the issue. The problem is in the importing process. I notified the developers - they are working on fixing it ASAP.

Thank you for reporting this!

Regards,
Alexander

Hi Alex,

Thanks for your help, I appreciate it.
Can I request to be notified when the issue has been fixed? What does the timeline look like? I would like to put the website into operation ASAP.

Ray

Hi Ray,

I asked to notify this thread when the fix will be deployed.

Regards,
Alexander

Any update on this. I have the same problem…trying to upload 7k records and the key field is partially treated as numbers even though its supposed to all be text. Now having to delete all the records.

Hi,

The fix is still in progress by the developers team.

Meanwhile you can try the following workaround :

Approach (details below):

  1. Add beforeInsert hook for the collection you need to import data that will take a value from a temporary field and set it for the real one (explained below)

  2. Import data while the target field for the problematic numeric-like source column is defined to be a new temporary column (not the real text-defined one)

  3. Verify that the content loaded as expected

  4. Delete temporary filed from the collection

  5. Delete the beforeInsert hook

Details

  1. Adding hook :
  • Go to the collection (in this example it is Info collection), click on Hooks button and then on " Add hook ":

  • Select the Before Insert hook:


The data.js file will be added into the Backend folder (in case it wasn’t there yet) and it will be open in the editor. Add the following code into the hook - assuming that the real field you want to upload the data to, is called year ( existing property defined as Text ) and that the temporary field will be called temp_year :

 if (item.temp_year) {
    item.year = item.temp_year.toString();
 }

So it will look like this (make sure you use the correct hook):

  1. Importing data
  • Open the Import dialog and map all the “good” fields as you need, and the numeric-like text field to the new temp field - in this example named temp_year:

  • Continue with the import as usual.
  1. Verify
    Now it is expected to have the correct data in the year property, and the problematic data in the temp property temp_year. Verify that it is the case indeed.

  2. Delete the temp property from the collection:

  1. Delete hook
    Delete the code from the insertBefore hook.
    Or the whole insertBefore hook if you don’t use it for anything else.
    Or the whole data.js file if there is no other code you need there.

I would suggest first to try this with small amount of imported data to verify that the process works as expected.

Regards,
Alexander

Same issue. Following.

First attempt didnt work.

Subsequent attempts to import are giving me an “Unsuccessful Import” error message.

Instead of making new temp_year fields, during the import I’m pointing it to import to existing field “temp_year”.

Hi Ken Yeh,

  1. Does import of that exact file passes without the beforeInsert hook? It’s basically the only workaround’s intervention into the importing process - so it should work without hook. Please check that.

  2. Then please share the data you try to import (few row samples), the exact hook and the collection’s schema (screenshot would do it).

I… realized I wrote toSring instead of toString…

=T

Will give update once I do some more testing.

1 Like

Yup, the work around with the hooks is great. Just had to use the other types of hooks like for Update, in addition of the Insert. Thanks for the help, much appreciated.

1 Like

Hello,

just a quick update about this issue: we believe this is fixed on our end. No errors should appear after importing numbers to text fields.

If you, however, encounter this issue again - let us know.

  • Justinas