Forward Engineer/Alter Script › The Template Editor › Customize a Template File During Schema Generation
Customize a Template File During Schema Generation
You can customize your schema generation options by modifying a default forward engineering template file in the Template Editor. Your customizations can add to or modify the options that are set in the Forward Engineer and Alter Script dialogs. For example, you can add or modify templates to navigate or extract content from your model.
Each database has a corresponding forward engineering template file. The template files are automatically installed to the \Program Files\CA\ERwin Data Modeler r8\BackupFiles\Templates folder. These template files are quite extensive so they cover all of the SQL required for CA ERwin Data Modeler's processes. Therefore, when you customize a template file, you should begin with the default template file and modify it for your specific needs. Save the template file using either the existing file name or providing a new name, and then associate it with a model for schema generation tasks.
Note: When you save a forward engineering template file using the default file name provided in this product, you are overwriting the template file. If you need to revert to the original, unchanged forward engineering template file, read-only backup copies are located in the \BackupFiles\Templates folder.
Rather than customizing a template file for schema generation outside of the schema generation process, you can customize a template file as you begin the schema generation process. Follow these steps to customize a template file during schema generation:
- Open the Template Editor in either of the following ways, depending whether you are performing Forward Engineering or Alter Script/Schema Generation:
- Click Forward Engineer, Schema on the Actions menu and click the Edit button in the Forward Engineer Schema Generation dialog.
- Click Forward Engineer, Alter Script on the Actions menu and click the Edit button in the Alter Script Schema Generation dialog.
- Select the template file that you want to customize. By default, the Template Editor opens using the default template file for the target database of your model. If you want to use a different template file, click the Open Template File icon to open the Open dialog and select the template file that you want.
- Customize the template using any of the following features in the Template Editor:
- Use the Sample Context box to select the starting object to use for the expansion of the template. You can change this selection at any time to view the impact of changes to a template. You can select the Show all check box so that all objects that are valid as sample contexts are added to the Sample Context box.
- Use the Templates pane to select a template and double-click it to add the template content (code) to the Template Source pane.
- Use the Template Source pane to navigate and edit the code, insert macros, or print the text. The code is syntax-colored for the brand of SQL of the current model. You can also use the Toggle Auto Indent tool to automatically indent the code as needed.
- Use the Macros pane to select a macro to insert into the Template Source pane. Highlight (select) the area in the template source where you want to insert the macro and then double-click the macro to insert it. You can also use the Toggle Macro Categories tool to toggle between alphabetical and category display. Use the Edit Macro Categories tool create new macros.
- Use the Expanded Text pane to view the read-only results of expanding the current template against the currently selected sample context object. The results are syntax-colored for the brand of SQL of the current model. You can change the sample context object by selecting a new object from the Sample Context drop-down list. Once you begin making changes to the template, the Expanded Text pane clears to recalculate and display the new results. The results include information about the parsing and execution status (failure or success). If the current TLX template does not parse correctly, it will display parser information.
- Click the Save Template File icon when you are done customizing the template.
- Enter a file name to save it as a new (*.fet) template file or use the existing file name and click Save.
- Click Close to close the Template Editor.
- Click the Browse button to select the template file you just customized. The path for this file should display in the Database Template box. When you select the template it is associated with the model, and you can continue the schema generation process using the customized template file.
More information:
Forward Engineering Template Files
Using a Custom Template File During Schema Generation
The Template Editor
Using Option Sets