Run the application again

Note

Now you run the application again to test the Product window.

At this point the Product window should have all of the capabilities of the Customer window. Like the Customer window, the Product window functions as a master/detail window, providing support for retrieval, insert, update, and delete operations against the database.

  1. Click the Run button in the PowerBar.

    Run button

    PowerBuilder prompts you to save your changes.

  2. Click Yes.

    The application begins running, and the login window displays.

  3. Type dba in the User ID box.

    Type sql in the Password box and click OK.

    The database connection is established, and the MDI frame for the application displays.

  4. Select File>Report>Maintain Products from the menu bar.

    The Product window displays. The top DataWindow control shows all of the rows retrieved from the Product table.

    The bottom DataWindow control shows information about the product selection in the top DataWindow control.

    Shown is the Product window titled Maintain Products 1.   Across the top half are the headings Product I D, Product Name, Product Description, and Unit Price. Rows of data are displayed under the headings, and a hand icon points to the first entry, which is Product I D 300. The data in the selected row is dispalyed in the bottom half of the window. Text fields on the left are labeled Product I D, with the entry 300, Product Name, which is Tee Shirt, and Product Description, which is Tank Top. On the right is a Color drop down set to White, a text box labeled Quantity showing 18, and a Unit Price text box showing 9 dollars.
  5. Select Edit>Insert from the menu bar.

    This clears the dw_detail DataWindow and allows you to add a new row to the DataWindow. The cursor is in the Product ID box in the dw_detail control.

  6. Add a new product row by entering information in the boxes in the lower DataWindow.

    Use the Tab key to move from box to box.

  7. Select Edit>Update from the menu bar.

    This sends the new product data to the database and displays a confirmation message, as coded in the script for the ue_update event.

    The new product does not display yet in the top DataWindow, but if you open another product sheet, the new information displays. If you want, you can add code to the Clicked event of the update button to automatically refresh the data in the master DataWindow control.

  8. Click OK in the message box.

    Click a product in the master DataWindow.

    That product data displays in the detail DataWindow.

  9. Change the product’s unit price.

    Select Edit>Update from the menu bar.

    This sends the revised product data to the database and displays another confirmation message.

  10. Click OK in the message box.

    Select another product in the master DataWindow.

    That product’s data displays in the detail DataWindow.

  11. Select Edit>Delete from the menu bar.

    The product is deleted from the DataWindow immediately but is not deleted from the database until you select the Update option on the Edit menu.

  12. Select File>Exit from the menu bar.

    The application closes and you return to the Window painter.

  13. Close the Window painter.