Creating and saving a DataWindow object

Creating a DataWindow object

You create DataWindow objects using a wizard, and then enhance them in the DataWindow painter.

StepsTo create a DataWindow object:

  1. In the Solution Explorer, right-click DWStart.pbl and select Add New Entry from the pop-up menu.

  2. In the Add New Entry dialog box, select DataWindow Object from the categories list, select Tabular from the list of templates, enter d_custlist as the name, and click Add.

    The Choose Data Source for Tabular DataWindow page of the DataWindow wizard displays.

  3. Select Quick Select as the data source, select the Retrieve On Preview check box if it is not already selected, and click Next.

    The Quick Select dialog box displays.

  4. Click the customer table in the Tables list box.

    This opens the table and lists its columns as shown in the illustration below. For this DataWindow, you will select four columns.

    The image shows the Quick Select dialog box.
  5. Click id, fname, and lname in the Columns list box in the order listed.

    Scroll down the list and click company_name.

    DataWindow Designer displays the selected columns in a grid at the bottom of the Quick Select dialog box.

    NoteSelection order determines default display order The order in which you select the columns determines their default left-to-right display order in the DataWindow object. If you clicked a column by mistake, you can click it again to clear the selection. You can also rearrange columns later in the DataWindow painter.

    You can use the grid area at the bottom of the dialog box to specify sort criteria (for the SQL ORDER BY clause) and selection criteria (for the SQL WHERE clause).

  6. In the grid area of the Quick Select dialog box, click in the cell next to Sort and below Id.

    A drop-down list displays.

  7. Select Ascending from the drop-down list.

    This specifies that the id column is to be sorted in ascending order.

    The image shows the sort drop-down list.
  8. Click OK.

    The DataWindow wizard asks you to select the colors and borders for the new DataWindow object. By default, there are no borders for text or for columns.

  9. Click Next.

    This accepts the border and color defaults. The DataWindow wizard summarizes your selections.

  10. Click Finish.

    DataWindow Designer creates the new DataWindow object and opens the DataWindow painter.

Understanding the DataWindow painter

The Design view in the DataWindow painter is divided into four areas called bands: header, detail, summary, and footer. You can modify the contents of these bands. For example, you can change their sizes, add objects (controls, text, lines, boxes, or ovals), and change colors and fonts.

In the Design view, DataWindow Designer displays a Heading band with default headings and a Detail band with the columns you selected:

The image shows the ID, First Name, Last Name, and Company Name column headings in the header band and the column names in the detail band.

The Preview view displays the DataWindow as it appears at runtime. DataWindow Designer displays data for all customers. The data is sorted in ascending order by customer ID, as you specified in the wizard.

The preview view shows the same column headings as the design view, but the first 10 rows also display.

NoteDisplaying the Preview view If the Preview view is not displayed, select View>DataWindow Painter Layout>Preview from the menu bar. If Preview is grayed, it is already displayed and you cannot select it. You can open only one Preview view at a time.