Editing Fields to Change from Numeric to Alphabetical
A Portable Database
Brought to you by:
jmbowman
Hi - Just simple question as I couldn't find the answer anywhere...
If you want to edit a field in the database and change the field type from numeric to say alphabetic, how do you do this as the option is always greyed out.
any help greatly appreciated.
Anonymous
There's currently no way to change a field's type directly in the application. Instead, you can export the data to XML, edit the XML file, and then import it again. Documentation of the XML format is at https://portabase.sourceforge.net/portabase_xml.html . The main things are to change the appropriate "ctype" element content and change the letter used as the element name for values in the data rows, although depending on the change being made you also may need to change some filter condition operator codes, etc.
You could also export the data to CSV, delete the column to change, add it back with the new type at the same position, delete all the data, and then re-import the CSV file. That avoids needing to manually muck around with an XML file, but would remove the field from any filter conditions, views, etc. that reference it.
I made the decision not to support field type changes early in PortaBase development when doing it properly would have been far more complex than almost any of the application's other features. It's probably more reasonable to add now for certain kinds of changes, but there are some conversions (like alphabetic to numeric) that just can't be done reliably for all data files. And the priority of such a feature enhancement would fall below tasks such as uploading new installers with all the recent bugfixes, Qt upgrades, etc.