The workarounds described in this article are not recommended to use. If they are implemented incorrectly, important business-logic can be disrupted, and it will lead to errors in the system. You should only use these workarounds if you cannot avoid it. |
By default, you can only specify the column type when creating a column. After it is created, the Column Type field is read-only.
However, there is a workaround to change the column type after a column is created. The original column type and the new one are not always compatible without using a script.
The following types can be changed without using a script:
Use scripts to convert data of different column types. The following examples illustrate some common transformations:
Date → Date/Time:
const record = new SimpleRecord('table_name'); record.addQuery('date_field', 'isnotempty'); record.query(); record.silentMode(true); while (record.next()) { record.datetime_field = record.date_field + ' 00:00:00'; record.update(); } |
Date/Time → Date:
const record = new SimpleRecord('table_name'); record.addQuery('datetime_field', 'isnotempty'); record.query(); record.silentMode(true); while (record.next()) { record.date_field = record.datetime_field.slice(0, 10); record.update(); } |
To change the column type for many records, use the quick import of a JSON file. For example, if you need to change the type of the Start Date [start_date] column from Date to Date/Time, complete the following steps:
By default, the column name can only be specified when creating a column. After a column is created, the Column Name field becomes read-only. It prevents collisions in the work of business logic records (scripts and fields of Conditions type) that refer to the Column Name attribute.
However, there is a workaround to change a column name after a column is created.
This workaround is only applicable to the columns of the non-versioning tables (Is VCS Enabled attribute is No). |
Start by searching for the business logic records that use the Column Name attribute of the column you need to rename. To do this, complete the following steps:
Next, change in sequence all occurrences of the current column name in all objects specified in the Document Record field of the VCS records you find.
It is critical to find and change all business logic objects using the current column name before proceeding to the next step. |
Finally, create a new column with the name you need and import the contents of the column you need to rename into the newly created column. For example, if you need to change the name of the Start Date column from [start_date] to [start_date_time], complete the following steps: