To import a CSV datafile to a node that contains a CCK "node reference" field, I use the node refeference NID in the datafile. But the import module doesn't recognize this data. All the other datafields are imported correctly, only the field with a node reference is not imported. Also in the import preview this field is not showed at all.

Is there a solution for this?

Comments

redmood’s picture

subscribed, i have the same big problem: someone has solved it ? Anyway, it will be usefull to have the option "delete all previous nodes before import"

asb’s picture

Priority: Normal » Critical

Hi,

I can confirm this error; however, it appears differently on my site.

(1) One node reference field should be filled with nid references like 26311, 26312, 26313.

-> The values in this CCK node reference field are ignored completely, no values are being inserted.

(2) Another CCK node reference field should not be filled with any values by the Node import module;

-> Instead of leaving this field empty, the module insertes references to nid:14536 (which is nowhere referenced in the CSV file).

(3) A third CCK node reference field also should not be filled with any values by the Node import module;

-> Same as (2), nid:14536 is inserted in all imported nodes.

The support for CCK node reference fields seems to be completely broken at the moment.

DON'T use the Node import module in rev. 5.x-1.6 if you want to fill in CCK node reference fields!

Greetings -asb (currently deleting a failed import with several hundred nodes)

mdowsett’s picture

Status: Active » Fixed

I had this issue just now as well and fixed it...

In your CCK setup for that field, change it from 'Select List' to 'Autocomplete Text Field' and then by putting in the nid you want to reference in your CSV file you are importing, it works.

I hope it works for you, it worked for me!

asb’s picture

Status: Fixed » Active

Hi,

> In your CCK setup for that field, change it from 'Select List' to 'Autocomplete Text Field' and
> then by putting in the nid you want to reference in your CSV file you are importing, it works.

The CCK node reference fields in my case are configured as "Autocomplete Text Field"; I rechecked this and even retried an import, with the same result as described above.

However, thanks for the tipp; maybe it works for others (this issue appears quite erratic, most probably due to the complexity of the CCK data model).

Greetings, -asb

PS: Please do not set an issue to "fixed" if the issue is not yet being fixed; even if fiddling around with the CCK fields would solve the issue for all users, it'd still be a workaround, not a fix - as long as the module's auther does not limit the modules description to something like "does not fully support CCK fields"; then this would be an expected behaviour; as it is now, it is an issue. Thank you!

m4manas’s picture

May be you can try the patch for the Select List and then try importing
http://drupal.org/node/273423

I am running into different problem of not able to import the date field. using date 1.8x

edzhus’s picture

I applied http://drupal.org/node/273423 patch and changed my node_reference field type to Auto Complete.
This works for me, finally I'm able to speed up my content creation.

Thanks!

eoneillPPH’s picture

I have some imports work fine putting in node references. The one where it is a big problem is where the referenced field is a shared one (so it's in a separate cck table). I tried changing the widget type to autocomplete, and cleared the cache, but no good.

$node->field___my_shared_field = array(
    0 => array(
    	'nid' => $city, // looked up and does have a valid value.
        ),
);

The only workaround I can think of is, after saving the node, reference the nid and vid and manually insert the referenced field via sql. That's not very Drupal-ish though. But it's what I already have to do for multi-value fields.

Robrecht Jacques’s picture

Version: 5.x-1.5 » 5.x-1.7
Status: Active » Postponed (maintainer needs more info)

So this is fixed when #273423 is applied? That fix will be included in the next release of node_import (5.x-1.8) released later this weekend.

Robrecht Jacques’s picture

Status: Postponed (maintainer needs more info) » Fixed

Setting this as fixed. Reopen it if you still have the same issue after trying 5.x-1.8. Thanks!

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

zw111aaa’s picture

I think the error is happend in this file (C:\xampp\htdocs\sites\all\modules\cck\modules\nodereference\nodereference.module line 861 ~ 876)
the $sql's param has a mistake.
$sql:
SELECT n.nid, n.title AS node_title, n.type AS node_type FROM {node} n WHERE (n.type = '%s') AND (n.title = '%s') ORDER BY n.title, n.type
$args's value
0 = n.type
1 = .nid

so,the error is happend

grincon’s picture

I took the field from autocomplete to select and it loaded fine using NIDs for the node reference fields.

http://www.colomsoft.com