I have a field that has multiple values, but comes from multiple columns. So instead of having, for example:
A||B||C
in one column, I have three columns that has values A, B, and C respectively.
In some cases the content of the columns are empty, and that means that subsequent columns do not get imported. For example, if I have the first two columns blank, and the last column set to 'C', 'C' never gets imported.
I found the problem--in that the array with the data gets filtered. But the indices for that array remain the same. But when the data gets transferred from 'cck:fieldname:value' in $values into 'fieldname' for node import, it references the indices based on the number of items, not the actual array keys.
In node_import.inc I see the input value array gets culled twice-- I don't know if that is on purpose (line 637, and 678). In any case, I re-index the array. Included is a patch for testing.
| Comment | File | Size | Author |
|---|---|---|---|
| node_import.patch | 591 bytes | legion80 |
Comments
Comment #1
achtonI just spent 16+ hours trying to track down a solution to this exact problem. I didn't realise the circumstances that triggered it, until just now. I'm astounded that this issue has not been a problem to others before us.
I, too have multiple fields that receive values from multiple columns in the CSV file, but I couldn't figure out why the values appeared in the nodes so randomly. It turns out it had to do with empty fields in the CSV columns!
I have tested the patch on two seperate installs and just now imported 60 nodes successfully to a custom content type with 6-7 cases of these multi-column data sources.
Thanks, legion80, for this (simple!) bug fix - it should go straight into CVS, IMO. Although, since I am not an experienced developer, and can't say that I fully understand the implications of this fix, I won't RTBC it.
Robrecht, you should be able to determine if there are any repercussions of this fix.
Comment #2
arkjoseph commentedold issue here but I would like to avoid the pipes for data managability as well.
What are the column headers of the following rows of content after the first one?
ex:
field_example_multi -
lorem lipsum | eidit more | eeeit dola
lorem lipsum
lorem lipsum | eidit more | eeeit dola
| = new column