Home Documents Template



Use template to define the format for destination file, one template will generate one file for each table.


The following properties can be setted for a template:

  • Display Name
  • Path Information:
    1. File Name
      the name for template file
    2. Destination Path
      the name for the generated file
  • Overwrite target: actions when the target file exists
    1. No Action & Generate files
      Default. generate file directly
    2. Overwrite
      Reserved. Same with the above, overwrite the target file
    3. Skip
      Skip this file
  • Skip this file: Skip this file or not when generate project files and generate a parent folder.
    1. No
      Default. generate file
    2. Yes
      Skip this file when generate project files or generate a parent folder.

Preview a template

Use the following steps to preview a specified file

  1. Select the file you want to generate
  2. Select menu: Template/Preview Template

Generate a template

Use the following steps to generate a specified file, this will always generate file and don't care the setting 'Skip this template'

  1. Select the file you want to generate
  2. Select menu: Template/Generate Current file/Folder

Template Syntax

  • Script block

    println(table.getName()); //Javascript code
  • Script line

    <$= table.getName()$>
    or <%= table.getName()%>

Javascript Objects

The following javascript objects are available in templates, select menu Edit/Javascript function list for more detail information for each object.

  • Database
    Use variable db to get the current database
  • Table
    use variable table to get the current table
  • Field
    field information for a table
  • ForeignKey
    foreign key information for a table

Include javascript file

use function include() to include another javascript file. e.g.

Include other template file

use function includeTemplate() to include another template file. e.g.

File search order in include

the search order in function include() and includeTemplate() is:

  1. Current template folder
    the folder for current template, if include(b) in file a, then the current folder is the parent folder of a
  2. Project folder
    the folder for current project
  3. user library folder
    ${Code Generator home folder}/userlib/js
  4. Code Generator home folder
    ${Code Generator home folder}. the folder where this code generator installed


Last Updated on Monday, 26 January 2009 09:00