Closed (duplicate)
Project:
Node import
Version:
5.x-1.6
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
9 May 2008 at 23:31 UTC
Updated:
18 Oct 2008 at 08:48 UTC
In general I have been pleased with this module. I have used it to import more than 14000 nodes. I now have another 17000 nodes to import. These new nodes have a nodereference field that refers to the first 14000 nodes.
The problem is that the nodereference field does not always properly import. It is totally random when it works or doesn't work. I have checked and double checked the text and it is a perfect match to the node name.
Is there something I need to do to get the nodereference field to work properly?
Comments
Comment #1
winarcht commentedI also got this problem.
The node reference fields link to the wrong fields.
Comment #2
jbrauer commentedComment #3
websites-development.com commentedi've been dealing with importing data into cck. My hack was to add a field in cck that contained a unique id. cck makes a table for each field mapping the node id and that field's value and using a db query you can get the nid based on that known unique value and create the csv file for import with the proper node reference
I am very new to drupal, and if there was a simpler way I've missed please let me know.
Comment #4
vacilando commentedSame problem. Perhaps there is an alternative solution for importing nodereference data?
Comment #5
redmood commentedI have the same problem too, and i think it will be useful to allow the selection of which filed to use as reference key, i mean:
you've got
PRODUCT with
code,
title,
text
and PRODUCT_PART with
code,
title,
text
and a node_reference_field to PRODUCT
When you try to use node_import module (node_reference importing problem apart) it only uses, as reference key, the $node->nid. But often in real cases, a client export 2 CSV:
1st with the list of PRODUCTs with obvioulsy this columns: code,title,text (and the code normally is never the drupal nid, suppose they're existing products of the client, before the use of drupal...)
2nd with the list PRODUCT_PARTs with this columns: code,title,text,product_code
I know it's possible to set the mappings, but in the case of 2nd file, is not possible to map product_code with the field "code" of PRODUCT, it's only limited to the its nid.
Comment #6
Robrecht Jacques commentedDoes the nodereference use a "Select List" or "Autocomplete Text Field" widget?
Comment #7
redmood commentedselect list...
Comment #8
vacilando commentedIn this version, I also noticed that importing into simple text select list did not work - the values did not even show in the preview and they did not import either. To solve that, I had to change the field type from text select list to simple text, and then later change it back (I could do this because I have single values only -- not sure what happens with multivalues).
I am just saying that select lists, not only in nodereference, may have a common problem.
Perhaps this comment will help debugging this.
Comment #9
jscheel commentedThis seems to be happening with user references as well.
Comment #10
joachim commentedDoes this work correctly is the CSV has the node ID rather than the node name?
Comment #11
Bobuido commentedI imported a bunch of records yesterday
I had three node reference fields in the target content type - None of these were being mapped (was going to fill them in manually later)
All of these fields pointed to the same node after import
Sounds like the same problem so thought I'd let you know :)
Now that I thought on it some more I've just realised the references were supposed to be referencing a content type I hadn't yet imported the definitions for
Perhaps that was my problem...impatience
Comment #12
a_c_m commentedI think the issue could be the search method used by the cck/content.inc
SOUNDS LIKE is a special search method, http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#operator_so... will make best guesses on what you meant. Which could be why it sometimes gets it wrong. Just change the SQL statement to something closer to what you need. e.g. "SELECT nid, title FROM {node} WHERE title = '%s'" for perfect matches.
You may also consider changing the "else{" to "else if(trim($value) != ''){" or you may find matches for rows with no node reference field values (http://drupal.org/node/294315).
Comment #13
Bobuido commentedI'll have to admit I don't quite understand what you're talking about
My problem was slightly different to this issue as I didn't want Node Import to fill in the reference and it was guessing for me!
I was able to enter NULL in the node import UI and remove the incorrect entries
Comment #14
Robrecht Jacques commentedNodereferences had some problems which should be fixed. Select list (or option widgets) had some problems as well which should be fixed as well.
Both fixed will be included in the next release of node_import (5.x-1.8) released later this weekend. Setting this issue as duplicate. Reopen it if yous till have issues after trying 5.x-1.8.
Thanks!