Saturday, November 1, 2014

About PowerBuilder DataWindow control


The DataWindow control is a container for DataWindow objects in a PowerBuilder application. We can use it in a window to present an interactive display of data. The user can view and change data and send changes to the database.

In addition to the DataWindow control, the DataStore object provides a nonvisual container for server applications and other situations where on-screen viewing is not necessary.
The DataWindow supports data retrieval with retrieval arguments and data update. We can use edit styles, display formats, and validation rules for consistent data entry and display. 

The DataWindow provides many methods for manipulating the DataWindow, including Modify for changing DataWindow object properties. We can share a result set between several DataWindow controls and we can synchronize data between a client and server.
We can develop both parts of your DataWindow implementation in PowerBuilder. We use:

The DataWindow painter to define DataWindow objects.
The Window or User Object painters to add DataWindow controls to windows or visual user objects. The DataWindow control is on the drop-down palette of controls for these painters.
In the Window or User Object painters, we can write scripts that control the DataWindow’s behavior and manipulate the data it retrieves. Wer scripts can also instantiate DataStore objects.

In the PowerBuilder Browser we can examine the properties, events, and methods of DataWindow controls and DataStore objects on the System tab page. If we have a library open that contains DataWindow objects, we can examine the internal properties of the DataWindow object on the Browser’s DataWindow tab page.

DataWindow objects
The DataWindow control or DataStore object uses a DataWindow object defined with any presentation style. The DataWindow object determines what data is retrieved and how it is displayed. The control can also display Powersoft reports (PSRs), which do not need to retrieve data.

Database connections
The PowerBuilder DataWindow can use ODBC, JDBC, and native database drivers for database connectivity. Users can connect to a data source on any server to which they have access, including databases and middle-tier servers on the Internet.
To make a connection, we can use the internal Transaction object of the DataWindow, or we can make the connection with a separate PowerBuilder transaction object.
A PowerBuilder application provides a default Transaction object, SQLCA. We can define additional Transaction objects if we need to make additional connections. When we connect with a separate Transaction object, we can control when SQL COMMIT and ROLLBACK statements occur, and we can use the same connection for multiple controls.

Datawindow Coding
We write scripts in the Window or User Object painter to connect to the database, retrieve data, process user input, and update data.
In PowerBuilder, we can take advantage of object inheritance by defining a user object inherited from a DataWindow control and adding your own custom functionality. We can reuse the customized DataWindow control throughout your applications.
We create DataStore objects, the nonvisual version of a DataWindow control, by creating them in a script and calling methods for the object. We can also define a user object that is inherited from a DataStore and customize it. 

Libraries and applications
We store DataWindow objects in PowerBuilder libraries (PBLs) during development. When we build your application, we can include the DataWindow objects in the application executable or in PowerBuilder dynamic libraries (PBDs).

No comments:

Post a Comment