Getting Started-JetNet

Lesson 15. Implementing Selection Screens

In Lesson 7, 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.

  1. Choose Yes to use the screen wizard.

    The Format Selection dialog opens.

  2. Select the Master-Detail option (the default) to define the sections.
  3. Deselect the Web Friendly Output option.
  4. Choose Next.The First Master dialog opens.
  5. Select orders from the list of Tables To Pick From.
  6. Choose .

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

  7. Choose Next.The First Detail dialog opens.
  8. Select order_items from the list of tables.
  9. Double-click on price.

    The selected column is 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 (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 Application Model dialog opens.

Generate selection screens

When you include columns from additional tables, the screen wizard lets you decide whether to generate selection screens (and selection service components). 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. At the same time, the screen wizard also creates selection screen service components (for three-tier models). As a result, additional services are required to carry out the appropriate requests.

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. Choose Next to accept the default architecture (three-tier) and components (client screen and service component, and selection screens). The Generate Selection Screens check box is selected by default.

    The Service Definition dialog opens.

  2. Change the Service Prefix to orditm and press TAB.
  3. Choose Next.

    The Style and Finish dialog opens.

  4. Change the screen title to Order Item Detail and choose Done.

    A preview of the client screen displays:

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

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

Save the wizard output

Save the client screens to client.lib and the server screens to server.lib.

  1. Bring focus to the client screen (Client1) and choose Save.

    The Save Screen dialog opens.

  2. Save the screen as orditm.scr in remote library client.lib.
  3. Repeat steps 25 and 26 for the service component (Server1), saving it to remote library server.lib. You can close the service component after saving it.
  4. Save the other screens to their appropriate remote libraries: titles.cit to client.lib and titles.sit to server.lib. You can close these screens also after saving them.

Define link and validation services

In addition to defining services to handle client requests made on the orditm.scr screen, you need to define the service that validates the data returned from the titles table, and a service that populates the titles.cit selection screen. De fine all the services in the JIF.

  1. Invoke the JIF editor and connect to the middleware (refer to Lesson 8 for details on using the JIF editor).
  2. Create the following services (press TAB after entering the service name, and accept or set the appropriate values):

    Service Name Routine Name Service Component













    (lowercase L + number one)





    titles.sit (include the extension)

  3. Save the JIF back to the remote common.lib, exit from the JIF editor, and release the reservation on the JIF.

    The application knows (as long as you are connected to the middleware) about these services as soon as you save the JIF and, therefore, you can test the client screen and the selection screen functionality immediately.

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. The service titles_c, which is defined as the Select Service property of the table view on the selection screen, is called and populates the screen.

  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 the validation service (titles_l1) 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: