0

I am very new to drupal. I currently have a content type called 'Issue', which has a plain text field containing something like "money, houses, pigs". How can I look at that string and turn each word into a tag?

The reason I have this is because I read data in from an older database, and they had their tags saved as a string. I read it in using the feeds module.

Is there a way to read in the tags differently? Or is there a way to parse that string and add each word as a tag in my content type?

Note, I read in the database as a CSV file.

My end goal here is to be able to 'query' for all Issues tagged with the word 'house' for example and display those.

Thanks in advance.

0

You can do it using the Feeds module, you probably could have done it when importing the data for the first time.

Create the Taxonomy you need with all the terms.

Export the relevant nodes information containing the text field, in the CSV copy the text field column and manipulate it so you can use it to import the terms into a multi-value Term reference field.

This requires a bit of Excel/Calc magic. It will probably be term IDs separated by semicolons IIRC.

Then use a Feeds importer to update the existing nodes (the same ones you exported), make sure to map the correct column to the Term reference field for the new Taxonomy.

  • Will this work if different rows have a different number of tags? ie, row 1 has "low, bank, office" and row 2 has "time, month, dolphin, monkey, computer"? – pootyy Nov 17 '18 at 0:56
  • Yes it will work, as long as you have the field set up to accept multiple values, Unlimited number or a fixed limit that isn't smaller than you need. And of course you need to have the values correct in csv and the mapping properly configured. You might need Feeds tamper module for multiple value imports. You will have all values for a single node field in one column, not in separate columns, but the values will be separated by a separator character so the importer "knows" how many there are for each individual field. – prkos Nov 17 '18 at 2:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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