I have some field types that are in text and have data and I need them to be a link or email type (ie. email module.) I realize there are several approaches: change in D7 database. Use the migration module. Export as Feature and re-import.

Does someone have experience addressing this and a suggested approach?

  • Clarification - I'm a system builder - I Would like to do this without programming. Concerned about using a low / level or raw function that does not explicitly describe use case of text conversion. – Sonicthoughts Nov 15 '14 at 23:23
  • The node export or views data export (or migration) are all valid approaches and worked ... however the most elegant is @Naveen Valecha who suggested using the helper module. Since it is a utility I was afraid that something might break under the hood and opted for this workaround. – Sonicthoughts Nov 19 '14 at 0:11
  • Too bad nobody created a module to do this using helper! – Sonicthoughts Nov 19 '14 at 0:12

A different approach could be - Why try to change field type ? Why not copy old to new ?

You could possibly use something like views data export or other similar module to create a dump of your nodes as node ID and text field to csv file.

Then create your new field.

Then use feeds to import your csv and assign the old text field column to your new field. Make sure you tick the box to update nodes !

Then delete your old field.

| improve this answer | |
  • yes, that is how I approached it. I then needed to delete the old field, rename the new and change the formatters. – Sonicthoughts Nov 19 '14 at 0:07

Use the db_change_field(). See the similar answer given by heddn

| improve this answer | |
  • Thanks - pls see comment above. Was hoping for a method for a system builder rather than developer.... but this may be a good fallback.. – Sonicthoughts Nov 15 '14 at 23:31
  • As Davereid Specified here innoraft.com/blog/… that the wrote some code in Helper mdoule(drupal.org/project/helper). To be frank I have not used this module before.if you want to take a look then you can :) and if that worked then also let us know. – Naveen Valecha Nov 16 '14 at 4:54

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.