A DataWindow is a powerful PocketBuilder object that allows you to access data and manipulate the data visually in a variety of ways. The DataWindow you build will display sales order information in a scrollable window.
Now you build the d_orders DataWindow object.
Select File>New from the menu bar.
In the DataWindow page, select Freeform and then click OK.
Select SQL Select as the data source and check Retrieve on Preview.
Click Next.
In the Select Tables dialog box, click customer, orders, and product.
Click Open.
In the Table Layout window, click the following items in this order:
order_id from orders
cust_name from customer
prod_name from product
quant from orders
price from product
disc, status, and notes from orders
The order in which the items are clicked determines the order in which the columns appear in the DataWindow. You can rearrange the order later if needed.
The Syntax tab at the bottom of the DataWindow painter displays the query that PocketBuilder will use to retrieve the data. Next, you modify the query to sort the result by order_id.
Click the Sort tab (at the bottom of the painter workspace) if it is not already selected.
Drag "orders"."order.id" from the left pane to the right pane.
Be sure that the Ascending check box is selected.
Click the Syntax tab.
The Syntax tab displays the selected columns as well as the sorting criteria. Notice how all of the SQL is generated without your having to type anything yourself.
This completes the data selection process. Next you manipulate the layout of the data displayed in the DataWindow object.
Select File>Return to DataWindow Painter.
Click Next to accept the default Color and Border settings.
Click Finish to generate the DataWindow.
Select File>Save and name the DataWindow d_orders.
Optionally add a comment to describe the DataWindow.
Click OK.
In the Detail band of the Design view, use Ctrl/click to select the Order Id: label and orders_order_id column.
Press the Delete key.
These are the first items under the Header band. The order_id is for internal use and is not displayed to users, so you can delete it.
Select the Cust Name: label and in the Properties view, change the Text property (at the bottom of the view) to Customer:.
Using the same method as the previous step, change Prod Name: to Product:, Quant: to Quantity:, and Disc: to Discount:.
The spacing of controls in a window is particularly important in Pocket PC development. Next you make all the controls fit in a single screen.
Select Edit>Select>Select All from the menu bar, and then drag all the labels and column names to the top of the band.
Align and space the labels and column names so they are closer together and look like this:
You can align controls in a DataWindow object by selecting them with Ctrl/click and then selecting one of the Format>Align cascading menu choices. You can equalize the space between controls by selecting them with Ctrl/click and then selecting one of the Format>Space cascading menu choices.
Select File>Save to save the DataWindow.
Close the DataWindow painter.