Modifying the data source of a DataWindow object

When modifying a DataWindow object, you might realize that you have not included all the columns you need, or you might need to define retrieval arguments. You can modify the data source from the DataWindow painter. How you do it depends on the data source.

Modifying SQL SELECT statements

If the data source is SQL (such as Quick Select, SQL Select, or Query), you can graphically modify the SQL SELECT statement.

To modify a SQL data source

  1. Select Design>Data Source from the menu bar.

    PowerBuilder returns you to the SQL Select painter. (If you used Quick Select to define the data source, this might be the first time you have seen the SQL Select painter.)

  2. Modify the SELECT statement graphically using the same techniques as when creating it.

    For more information, see Using SQL Select.

    Modifying the statement syntactically

    Select Design>Convert to Syntax from the menu bar to modify the SELECT statement syntactically.

  3. Click the Return button to return to the painter.

    Some changes you make (such as adding or removing columns) require PowerBuilder to modify the update capabilities of the DataWindow object.

    For more information about controlling updates in a DataWindow object, see Controlling Updates in DataWindow objects.

Changing the table

If you change the table referenced in the SELECT statement, PowerBuilder maintains the columns in the Design view (now from a different table) only if they match the datatypes and order of the columns in the original table.

Modifying the retrieval arguments

You can add, modify, or delete retrieval arguments when modifying your data source.

To modify the retrieval arguments

  1. In the SQL Select painter, select Design>Retrieval Arguments from the menu bar.

    The Specify Retrieval Arguments dialog box displays, listing the existing arguments.

  2. Add, modify, or delete the arguments.

  3. Click OK.

    You return to the SQL Select painter, or to the text window displaying the SELECT statement if you are modifying the SQL syntactically.

    Reference any new arguments in the WHERE or HAVING clause of the SELECT statement.

    For more information about retrieval arguments, see Defining DataWindow Objects.

Modifying the result set

If the data source is External or Stored Procedure, you can modify the result set description.

To modify a result set

  1. If the Column Specification view is not open, select View>Column Specifications from the menu bar.

  2. Review the specifications and make any necessary changes.

    If the data source is a stored procedure

    If you are modifying the result set for a DataWindow object whose data source is a stored procedure, the pop-up menu for the Column Specification view contains the menu item Stored Procedure.

  3. Select Stored Procedure from the Column Specification view's pop-up menu to edit the Execute statement, select another stored procedure, or add retrieval arguments. For more information about editing the Execute statement, see Using Stored Procedure.