Object Properties - Data Bindings

Note: See Properties Panel for an overview of how this tool works.

 

The Data Bindings tab page is used to bind a data entry object (DEO) to data. This is done by selecting a Data Dictionary Object (DDO) server and a Table/Column data source.

This page is only used by “data-aware” controls (all system classes prefixed with “db” and many other controls). If the selected object is not data-aware, then all the options on this tab page will be disabled.

If the object is a single value object such as a dbForm, you need to assign a single DDO server and a single table/column data source.

If the object is a column based object such as a Grid, you need to assign a single DDO server and a table/column data source for each column in the object.

In most cases, these assignments will already be correct. When data dictionary object structures are created using the DDO Explorer, the DDO servers are properly assigned. If you create a new DEO by dragging and dropping a table/column from the DDO Explorer the new DEO object will contain the correct DDO server and table/column data source. If you create a DEO object from the Class Palette, you will need to assign these values yourself.

Setting the Server Data Dictionary Objects

The Server Data Dictionary (Server DDO) object defines the objects connection point to a DDO in the data-dictionary structure.

The Server Data Dictionary is assigned by pressing the Prompt button and selecting the appropriate Data Dictionary from the list OF DDOs that are displayed in the Table Selector dialog.

Auto Assignment of DDOs

The list of available DDOs and the best DDO for an object is determined by your DDO structure. The Studio can determine if your current DDO choice is the best selection. The Studio makes this determination by evaluating the current DD structure’s DDOs, the Main-DD and any constraints. If the currently assign DDO is not considered to be the best server, the “Set Preferred Server” button will be enabled. Selecting this will select the best DDO for this object. Normally, the Studio’s choice will be the correct one.

The assignment of DDOs will usually only requires changes when the DDO structure changes. Often the best way to make sure that all of your DEOs use the correct DDO server is to select the “Set all DEO servers based on Main DD” option in the DDO Explorer.

 

Setting the Data Source

The object’s data source specifies the source of the data that will be displayed in the control. This is usually a column in a database table but it can also be any valid DataFlex expression. The data source is represented in source code using the Entry_Item command.

You only need to set a data-source for controls that directly display data (such as dbEdit or dbForm). Container objects (such as dbView, dbContainer3d, dbGroup, etc.) do not use a data source. When a container object is selected, this data source group will be properly disabled.

If the selected object is single item based, (e.g., dbForm) a single form showing the object’s data source will be displayed.

If the selected object is column based, (e.g., dbGrid) a list of all available columns will be displayed.

The group labeled “Data Source” or “Grid Data Source” enables you to assign the control’s data source. Normally you will want to assign a table and column name using the tableName-dot-columnName format (e.g. Customer.Name). This is most easily accomplished by using the Prompt button. This will display the Table/Column Selector dialog, which contains a list of all available tables and their columns.

If you want the object to use an expression, you must enter this expression name manually including the parentheses. For example, the command line “Entry_Item (MyFunction(self))” would be entered as “(MyFunction(self))”.

Note that you do not use this page to create a new column in a grid. That is done in the Column Properties tab page. After a new column is created, you would then select this tab page and assign the new grid column a proper data source.

When you select a table and column using the prompt, the Studio will check to make sure that the selected column is appropriate. If you attempt to select a "child"-table column that relates to a parent table, the Studio will automatically choose the appropriate parent table and column for you.

 

See Also

Properties