CodeCharge Studio

Data Dictionary Property Editor

You work with the property editor by selecting tables and fields. To open the property editor, double click on a table or field in the database explorer.

Data Dictionary Property Editor

You may notice that the panes of the Data Dictionary such as the Database Explorer and Property Editor all share the same window space with other views of your project, such as the Properties pane. Don't confuse the Properties pane with the properties you can can configure thru the Property Editor in the Data Dictionary. The properties in the Properties pane are related to the Project Explorer only. Changing the properties in the Properties pane changes the properties of components you have already created in your project. They are not part of the data dictionary. The only way to change properties in the data dictionary is with the Data Dictionary Property Editor.

The property editor defines properties associated with the Code Charge Studio Builders. There are three classifications of properties you can change: Table, Field, and Control Type.

Table - If you include this table in your datasource, you can customize the caption that appears on the forms depending on the type of form generated (e.g. Display - Grid, Input - Editable Grid). You can also also assign actions to events associated with these forms. You cannot define custom code, and the events you select are only added to your page if you include this table in your datasource. For example, you can define a caption for a Record form (Input), and assign actions to events related to handling the Record form. Any time you run the Record builder this caption will be used for the form caption, and the events will be added to your page.
Database Columns - The 'database columns' pane is mostly for displaying database information about the table you selected. You cannot change any properties except adding or removing a field from the primary key (right click next to the field name).

Control - the 'control' pane is where you select the properties for the control type associated with the field you select in the database columns. The properties for each control type is the same as the properties you would set for a control in the Properties pane of the Project Explorer.

The 'Display' tab and the 'Input' tab refer to the set of controls that are generated by different builders. For example, a Grid only includes 'Dislay' type controls since a grid is used to display data. A Record form is normally used to collect data, so a Record form normally includes 'Input' type controls. The set of 'Display' controls is actually a subset of 'Input' controls since some fields of input forms may also be designated to display data (e.g. a field of a Record could be a Label control used just to display some database field that you want users to see but not change). Just remember, 'Display' and 'Input' are related to the controls generated by default by the type of builder.

The 'control' pane is where you define the properties for each field. The tabs on this pane are 'Display' and 'Input'. This refers to the type of control that appears on a form. For example, a Record form (Record builder) is normally an input type form. The Record form is normally built as a row of TextBox or Listbox controls, from which you either enter or select something. That is, the Record builder creates the form from a set of Input type controls. Which control gets assigned to the field depends on the datasource and the field type in the record.

When you run the Record builder, every field is assigned to a default control. You can change the control type in the builder for each field but this becomes very tedious if you create a lot of forms this way. The data dictionary provides an alternative approach. For each field, you can select the default control type that will be assigned to this field by the builder. You can also define the properties of the control. These are the same properties you would assign to the control after the form was generated by the builder. Some properties, such as 'Caption' are shared by all the input controls, so setting the caption for one input type control will set the caption for that field for every other type of control assigned to the field. Other properties, such as 'Max Length' are unique just to certain types.

For example, to assign and configure the input control for the 'group_id' field in the Employees table, click on the field and then the Input tab. The control type displayed is the one currently configured as the default. Normally for 'integer' fields, the default assignment in the data dictionary is 'TextBox'. You can see from looking at the tables, that the 'group_id' relates to the 'groups' table. It is fairly common then that you would change this control on the record to a ListBox and use the ListBox to display a list of Group names instead of forcing the user to enter a numeric value for the group.

Change the Input control type for the 'group_id' field from 'TextBox' to 'ListBox', and change the caption from 'Group Id' to 'Group Name' since the record form will display names instead of ids.

group_id change

You will notice that some properties were prefilled and did not have to be changed: Data Source, Bound Column, Text Column. This is because there exists a relationship between the Groups table and the Employees table on the 'group_id' field. CodeCharge Studio uses this relationship to assume that you want to use the 'group_id' field to look up something in the Groups table. See Database Explorer for more details about relationships.

When you create a Record form, and the Employees table is part of the data source, and you include the 'group_id' field from the Employees table in the record, this field will be bound to a ListBox control. That is, everywhere 'group_id' appears on a form, the field will be represented as a ListBox.

But, when you add 'group_id' to a Grid form, it will appear as a Label control. This is because we never changed the control type for 'Display' type forms, and the default control type is Label for display forms. You cannot assign a ListBox control to this field for a Grid. Although you could display the ListBox as a selected item, it would not make any sense to allow users to select a Group name since the record(s) from a Grid are never updated.

The form builders and the Application Builder do not utilize the Data Dictionary to build pages in the same way. By default, the Application Builder always creates two pages; one to display data from an included table, 'list' page, and one to update the table, 'maint' page. The two pages are linked by a unique field.

If you look at the Employees table, the 'emp_id' field uniquely identifies each record in the table. For this reason, the Application Builder sets the control type for this field to a Link control, and configures the properties so when this field is selected in the grid, the page is redirected to the 'maint' page and a query parameter is passed to identify the record that should be queried and displayed (e.g. ?emp_id=11).

This is a common technique used to handle primary key fields (unique record columns), but the form builders, such as the Grid builder do not make the same assumptions as the Application Builder. If you want to enable this by default, you need to change the 'display' control type, and configure the properties for these database fields in the Data Dictionary. The following section shows how to do this with a Link control.

See also

See next

Data Dictionary Example

On-line, printable versions and updates