Getting Started-2-Tier

Lesson 11. Implementing Selection Screens

Selection screens are available for the GUI interface, but not for web applications.

In Lesson 4, you created a master-detail screen that joined two tables: distributors and orders. In this lesson, you create another master-detail screen that joins the orders table as the primary master table to the order_items table. In addition to columns from the order_items table, the screen's detail section also includes data from the titles table. Thus, it can display the titles of the videos.

Because the screen's detail section contains multiple tables, the screen wizard:

In this lesson you learn how to:

  1. If necessary:

Join multiple tables

When you use the screen wizard, the first table you select for a section—master, detail, or subdetail—is considered the first (primary) table view for that section. For the screen you create here, select orders as the first master table and join it to order_items as the first detail table.

  1. Choose FileNewScreen or .

    The New Screen Tool dialog opens.

  2. Choose Yes to use the screen wizard.

    The Format Selection dialog opens.

  3. Select the Master-Detail option (the default) to define the sections and deselect the Web Friendly Output option. Choose Next.

    The First Master dialog opens.

  4. Select orders from the list of Tables To Pick From.
  5. Choose .

    This specifies to include all columns in the orders table on the completed screen.

  6. Choose Next.

    The First Detail dialog opens.

  7. Select order_items from the list of tables.
  8. Double-click on price in the list of columns in order_items.

    The selected columns are added to the list of those already chosen.

Add details from another table

The screen wizard lets you include information from other database tables in the same section, as long as the corresponding repository screens specify links to the section's first table. By selecting the titles tables in addition to the order_items table, the screen's detail section can display the name, number of available copies, and standard unit price of each video, along with the price and quantity data from order_items. The screen wizard includes links that define the relationship between order_items and titles.

  1. Select the Include Columns From Related Tables check box.

  2. Choose Next.

    The Additional Detail dialog opens and shows which tables can be joined to the order_items table.

  3. Select titles from the list of tables.

    The list of columns belonging to the titles table displays.

  4. Select (Ctrl+click) name, order_price, and quantity_avail.
  5. Choose
  6. Reorder the columns (select items and use the up/down position arrows) as shown:

  7. Choose Next.

    The Layout Selection dialog opens.

  8. Choose Next to accept the default layout specification: single row for the master and grid display for the detail.

    The Style and Finish dialog opens.

Generate selection screens

When you include columns from additional tables, the screen wizard lets you decide whether to generate selection screens. The usefulness of selection screens depends on the client screen's function. For example, a data entry screen might make good use of a selection screen, while a display-only client screen probably would not.

More About Selection Screens

When the Generate Selection Screens check box is selected, the screen wizard automatically creates a selection screen for every additional table that you include on your client screen.

Selection screens, sometimes called pick lists, are useful when a user is adding a new record to the database. The selection screen displays a list of acceptable values for a field when the user requests help.

  1. The Generate Selection Screens check box is selected by default. Change the screen title to Order Item Detail and choose Done.

    A preview of the client screen displays:

  2. Choose Yes to confirm the contents of the screen.

    When the wizard finishes building the screens (notice the status bar), the results include two screens:

Save the wizard output

Save the screens to client.lib.

  1. Bring focus to the client screen and choose Save.

    The Save Screen dialog opens.

  2. Save the screen as orditm.scr in library client.lib.
  3. Save titles.itm to client.lib. You can close the screen after saving.

Test the selection screen

Now test the screens.

  1. Give focus to client screen orditm.scr .
  2. Choose FileTest Mode or .

    The Order Item Detail screen opens.

  3. Choose .

    The first record in the orders table displays. Several order_item records are associated with this order. They are displayed in the grid.

  4. Click in the Title_id field of the first empty row in the grid.
  5. Press F1 (or HELP).

    The Titles Selection screen opens and displays all video records in the titles database table.

  6. Scroll down to the title Cinema Paradiso and double-click on the ID to select that video.

    The selection screen closes and the record you selected appears in the grid on the Order Item Detail screen. The cursor advances to the next data entry field in the grid (qty).

  7. Enter 3 in the Qty column.

Validate the data

Add another item to this order, but this time, enter the title identification number. Panther uses a validation routine to ensure that the entry is valid.

  1. Press TAB to advance to the next empty row and type 55 in the Title_id column. Press Enter or TAB.

    Willie Wonka and the Chocolate Factory is the name of the video associated with the specified ID number.

  2. Choose .

    This action saves the new items to the selected distributor's order.

  3. Return to the editor.

What did you do?

You created an order entry screen that provides an easy way to add items to an order. You did this by performing these tasks:

What did you learn?

You learned: