Master/Detail screens are one of the most common application requirements. Whenever you display a one-to-many relationship, such as one customer/many invoices, one invoice/many invoice items, one part/many part numbers, you are working with master/detail relationships. Setting up these relationships with traditional client/server tools can require hours of tedious programming. Not with DX!
DX lets you create master/detail screens simply by dragging and dropping columns of data. First you create a master field. Then you create a slave table. Next you specify the relationship between master and slave by modifying the where widget of the Table resource.
For example, to display an invoice number along with all invoice details, follow these simple steps:
- With the Object Type Data Field selected in the Schema Browser, drag and drop the Invoice column on to the Browser. A new application is created in a separate window.
- Resize the application container so there is enough space for a table.
- Select Table from the Object Type menu of the Schema Browser.
- Now select all the columns you want to display with each invoice number. Drag and drop them on to the application window to create add a table to your application.
- Now specify the relationship between master and slave by adding a "where" clause to the Table resource. Click on the dbTable widget in the Browser. The widget's resources appear in the Resource Editor. Locate the where resource in the Resource Editor, and enter the following in the input field:
The "where" clause creates a relationship between the dbTable widget and the invoice_Invoice_number widget. When the value of invoice_Invoice_Number changes, it is substituted into the "where" clause and the query is re-evaluated.
Switch to Play Mode and press Search. As you move through successive invoices, note that the invoice detail table is automatically updated!
- Tutorial 3: Master-Detail Display and Entry Form Application provides a detailed walk through the Master-Detail application creation process.