Programmatically rename fields

I have inherited a project which contains a lot field of fields with invalid names: they contain “illegal characters” such as spaces, dashes, slashes. All together there are over 1000 fields, that need to be changed, a task that I would like to automate.

How can I programmatically change the name of a field?

I’ve looked at the SQL reference, but it looks like 4D doesn’t support renaming of fields.

I went through this a few days ago : you can delete fields with SQL and I suppose you can rename them but, if the name is invalid, it fails. This looks logic but I didn’t find any other automated solution…

: Rob LAVEAUX

I have inherited a project which contains a lot field of fields with
invalid names

If - and only - if, you are doing a major refactoring, followed by a full testing:

  • export your structure as XML
  • rename fields in the text file.
  • make 100% sure and double check twice, that you do not change table UUIDs or field order, just rename titles
  • create a new structure based on the modified XML
  • drag&drop all forms, methods, etc to the new structure.

As long as you followed the procedure above, you can even open the old .4DD files, as all UUIDs are unchanged.