You can click each column you want to include from the table representations in the Table Layout view. PowerBuilder highlights selected columns and places them in the Selection List at the top of the SQL Select painter.
To reorder the selected columns:
Drag a column in the Selection List with the mouse. Release the mouse button when the column is in the proper position in the list.
To select all columns from a table:
Move the pointer to the table name and select Select All from the pop-up menu.
To include computed columns:
Click the Compute tab to make the Compute view available (or select View>Compute if the Compute view is not currently displayed).
Each row in the Compute view is a place for entering an expression that defines a computed column.
Enter one of the following:
An
expression for the computed column. For example: salary/12
A function supported by your DBMS. For example, the following is a SQL Anywhere function:
substr("employee"."emp_fname",1,2)
You can display the pop-up menu for any row in the Compute view. Using the pop-up menu, you can select and paste the following into the expression:
Names of columns in the tables used in the DataWindow or pipeline
Any retrieval arguments you have specified
Functions supported by the DBMS
Press the Tab key to get to the next row to define another computed column, or click another tab to make additional specifications.
PowerBuilder adds the computed columns to the list of columns you have selected.
Computed columns you define in the SQL Select painter are added to the SQL statement and used by the DBMS to retrieve the data. The expression you define here follows your DBMS's rules.
You can also choose to define computed fields, which are created and processed dynamically by PowerBuilder after the data has been retrieved from the DBMS. There are advantages to doing this. For example, work is offloaded from the database server, and the computed fields update dynamically as data changes in the DataWindow object. (If you have many rows, however, this updating can result in slower performance.) For more information, see Chapter 19, “Enhancing DataWindow Objects.”