CodeCharge Studio

Using the Data Dictionary

The Data Dictionary can be used to define properties of controls that are used by the form builders. In this way, you can reuse property settings and minimize the amount of customization that you apply to the forms created by the builders.

The Data Dictionary can also be used to view the database catalog, change properties of the forms generated, and also import or export data dictionaries you've defined.

Before you can use the Data Dictionary feature, you must first create a database connection, if one does not already exist. See Creating a New Database Connection for more details.

The data dictionary you define may be exported to an XML file. This allows you to archive and reuse, or share the data dictionary with other projects or users, or create different versions of the data dictionary.

The data dictionary is associated with a particular database connection by name. So for example, if you have a connection called IntranetDB, the data dictionary will, by default, have the same name as the connection name, and all of your current settings will be saved in an XML file called IntranetDB_DataDictionary.xml.

The data dictionary is accessed from the 'Data Dictionary' tab on the ribbon bar. The Data Dictionary may also be accessed from the Application Builder.

Note, you can customize the control properties after running one of the builders but if you later re-edit your forms by running the builder again, your changes may be lost. For example, suppose you have a database field called 'order_date' and you have defined this as a required value in the data dictionary. If later you decide this field is optional for some of your forms, you can change the 'Required' property, but if you edit the form again with the builder, the property will be overridden by the builder.

Open Connection

The 'Open Connection' selection opens the database and creates a new data dictionary, if this is the first time the database has been opened, or loads an existing data dictionary.

When you select 'Open Connection' you should see a list of database connections. Again, you must define at least one database connection before you can define a data dictionary, and each data dictionary is associated with the database connection by name.

Next, you can select either the data dictionary you wish to open, or you can edit properties of the current database connection, which is by default either the database connection that appears in the Database Explorer, or a connection you are already working with.

Export

By default, the data dictionary settings are saved in an XML file associated with the database connection. The 'Export' action allows you to save the current settings in a file of your own choosing. This allows you to create different versions of the data dictionary and also share property sets with other projects.

Import

The 'import' icon on the ribbon bar can be used to import an existing data dictionary you have previously exported.

Refresh

If you have made any changes to your database while working with the data dictionary, the 'refresh' icon updates the current view of the database in the data dictionary and the 'Database Explorer'.

Relationships

The 'relationships' icon opens a window pane to view or change relationships between tables. This window is initially blank. To see the relationships between tables, drag and drop tables from the database explorer into the window. Relationships are depicted as connected lines between fields and tables (same as in the Query Builder). Relationships affect the way the builders create SQL queries for your forms. When two tables are linked, the builder creates an implicit join between the tables.

SELECT * FROM statuses
INNER JOIN (projects INNER JOIN (priorities INNER JOIN (tasks INNER JOIN employees ON
tasks.user_id_assign_by = employees.emp_id AND tasks.user_id_assign_to = employees.emp_id AND tasks.user_id_assign_by = employees.emp_id AND tasks.user_id_assign_to = employees.emp_id) ON
priorities.priority_id = tasks.priority_id AND tasks.priority_id = priorities.priority_id) ON
projects.project_id = tasks.project_id AND tasks.project_id = projects.project_id) ON
statuses.status_id = tasks.status_id AND tasks.status_id = statuses.status_id

If your database contains foreign key constraints (i.e. 'relations'), and the database connector you are using (e.g. OLEDB) supports discovery of these constraints, these are the relationships shown by default in the window. If CodeCharge Studio cannot discover the relationship between tables, there will be no links (i.e. lines) between the tables. This is a bit different from the Visual Query Builder (part of the Builders) which will attempt to link tables based on the field names in the tables. When field names are the same between two tables and one field in a table is a primary key, the Visual Query Builder will assume, and show, a link between the tables based on the name. For example, if the field name in the Tasks table is 'project_id', and the primary key in the Projects table is also 'project_id', the Visual Query Builder will join those tables on that field. If you want the data dictionary to create the same relationships, use the Suggest icon on the ribbon bar. This will create relations between two tables based on the field names. If you decide later that you do not want these type of links between the tables, you can use the Reset icon on the ribbon bar to remove all of these relations that have been added. You can also change the relations between tables directly in the relationships window by manipulating the links between the tables. To add a relation, click on the primary key in one table and drag it to a field in another table. See Defining a Relationship for more details.

Add Query / Query Type

You can use the data dictionary to create queries you can use instead of creating or selecting a datasource in the builder. A datasource is a table or query that your forms (e.g. Grid) are bound to. When you run one of the builders, you either select a table, or create a query using the Visual Query Builder. If you are often creating complicated queries that are either the same each time you run the builder, or very similar, you may want to consider creating the query in the data dictionary instead. Each time you run one of the builders, the query you create in the data dictionary should appear in the list of datasources you can select from. This way, you are able to create the query once and reuse it in the builders.

Like creating a query in the Visual Query Builder, you can also define the type of the query to create: Table, SQL, or Stored Procedure. See Using the Visual Query Builder for more details.

See also

See next

Changing Control Properties in the Data Dictionary


On-line, printable versions and updates