Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I am using D7, Feeds, XPath Parser. For mapping, I need to use a custom field as the unique field. I am retreiving data from booking.com and the unique value their is the hotel id, so i need to save this hotel id from the user as well as retrieve data from booking.com bsed on this unique field and map to my contents based on this unique field.

In the documentation of feeds i found this - Use field other than nid as unique node field in feeds for 7.x-2.x

It says you need to apply a patch from this comment - http://drupal.org/node/661606#comment-5921904

This patch applies to a file called field.inc in the mappers folder of feeds. However this file is not even present there. The patch also applies to another file, however running the patch gives errors.

  • Is field.inc actually present in feeds/mappers?
  • Am I making some mistake in applying the patch?
  • Is there any other way of achieving - custom field as unique field for mapping?

Any help on this would be greatly appreciated. Thank you.

share|improve this question
add comment

3 Answers

If you will only be using one Feeds importer (i.e. only importing from a single XML source), you can do this without applying any patches. In the importer mappings, just map the hotel ID field to GUID and set it as unique. If you need to use hotel ID in your content type, map it to another field as well.

From your description, it sounds like your needs might be more complex (i.e. importing from multiple sources into the same content type)? If so, you can use Field Validation module to set your field as unique. Note that last time I used it, this also required a patch - but it may be committed now. This Field Validation issue provides some more info.

I think the method you referred to (using Unique Field module) is a little outdated now.

share|improve this answer
    
Thanks for the answer. However I was able to get my requirement fulfilled from another patch and using field validation module. I haven't tried your method yet though it looks like it could have worked too :) Thank a lot! –  SGhosh Dec 18 '12 at 9:36
add comment
up vote 1 down vote accepted

Answering my own question -

Using patch from - http://drupal.org/node/661606#comment-6481214 on the feeds module and a patch from - http://drupal.org/node/1705386#comment-6481224.

Hence using Feeds with Field Validation. First a validation for unique must be added to the required field. In the mapping for just like title can be set as unique even this field will have the setting to be set as unique.

share|improve this answer
add comment

Can you please provide exactly what you did as I cannot get it to work.

I installed Field Validation Set my cck field (testID) to unigue I uploaded the field_validation.feeds.inc file to the field_validation home directory Now when I go into feeds I cannot get the USED AS UNIQUE button to show

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.