Previous Topic

Next Topic

Book Contents

Book Index

Upgrade Tables Using Templates

You can use XML templates to create an .ADB table file, or to upgrade an existing .PDB or .ADB table file. Template files can be generated using the GenerateSchema function.

For existing tables, the table schema will be upgraded based on the XML schema file. For new tables, a custom table file will be created in the data directory based on the XML schema file.

Note: For existing tables, any fields that are not included the XML schema file and have not been renamed to match new Custom fields added in the schema will be dropped and data in these fields will be lost. This also applies to custom indexes, as only indexes in the XML schema will be retained.

Upgrade a table in Table Designer

Upgrade an existing table from Navigator > Setup > Table Designer. After you have loaded a table, click the UpgradeTable Upgrade... (Alt+U) button. You will be prompted to select an XML template file.

Scripting Table Upgrades in MaxBasic

The MaxBasic UpgradeTable function can be used to create or upgrade tables.

UpgradeTable(TableFileName: String, TemplateFileName: String[, UpdateFields: Boolean, ReplaceSchema: Boolean]): Boolean

The TableFileName file is saved in the data directory. TemplateFileName must be a fully specified path.

For example, to add a Category 3 field to Customers, create a ARCAT3.ADB table, and extend the ARCUST.pdb table to add the new Category 3 field.

  UpgradeTable("ARCAT3.ADB", "c:\ARCategory3.xml")

  UpgradeTable("ARCUST.PDB", "c:\ARCustExtensions.xml")