Specifying required data in your application

Between the time that you develop an application and each time the user runs it, many changes can happen to the data at its source. Typically, the data within the data source is updated. But more importantly, structural changes can happen and these types of changes cause greater risk for your application to fail. When such condition occurs, you can

By default, the columns that display in a data-aware control are determined at run-time based on the Columns that appear in the DataSet. If the data structure at the data source has been updated and is incompatible with your application, a run-time error is generated when the situation is encountered.

JBuilder offers support for data persistence as an alternative handling of such sitations. Use this feature if your application depends on particular columns of data being available in order for your application to run properly. This assures that the column will be there and the data displayed in the specified order. If the source column of the persistent Column changes or is deleted, an Exception is generated instead of a run-time error when access to the column's data fails.

Making columns persistent

You can make a column persistent by setting any property at the Column level (for example, an edit mask). When a column has become persistent, square brackets ([ ]) are placed around the column name.

To set a Column level property,

  1. Open any project that includes a DataSet object, for example, select any project file (.jpr) in the samples\borland\samples\tutorial\dataset directory of your JBuilder installation. (This directory is available only if you selected the Typical option from the JBuilder setup program, or selected Sample files from the Custom option.)

  2. Select the Frame file and click the Design tab from the bottom of the right pane of the AppBrowser.

  3. Double-click the DataSet object from the Component tree. This displays the Column Designer for the data set. The Column Designer looks like this for the Local InterBase employee sample table:

  4. Select the Column that you want to set the property of. The Inspector updates to reflect the properties (and events) of the selected column.

  5. Set any property by entering a value in its value box in the Inspector. If you don't want to change any other column properties, you can set a value, then reset the value to its default.
To demonstrate, set the a minimum value for a Column containing numeric data by entering a numeric value in the min property. JBuilder automatically places square brackets ([ ]) around the column name.

In the Column Designer, the columns for that data set are displayed in a grid in the UI Designer. A toolbar for adding, deleting, navigating, and restructuring the data set is provided.

You could also do all of your column manipulation through the Column Designer. You can right-click on the header of the grid to select (or unselect) a column property. That property is added to, or removed from, the grid. This in convenient for setting global properties for every column in a data set, for example, width.

To close the Column Designer, double-click on any UI component in the Component tree, or single-click on a different component, and select Activate Designer. In other words, the only way to close one designer is to open a different one.