About DataWindow objects, controls, and components
DataWindow technology is implemented in two parts:
- A DataWindow object The DataWindow object defines the data source and presentation
style for the data. - A DataWindow control or component The control or component is a container for the DataWindow
object in the application. You write code that calls methods of
the container to manipulate the DataWindow object.
DataWindow controls and components
The DataWindow was originally invented
for use in PowerBuilder to provide powerful data retrieval, manipulation,
and update capabilities for client/server applications.
Now the DataWindow is available in several environments:
- PowerBuilder DataWindow A PowerBuilder control for use in client/server and
distributed PowerBuilder applications. - Web DataWindow A thin-client DataWindow implementation for Web applications
that provides most of the data manipulation, presentation, and scripting
capabilities of the PowerBuilder DataWindow, requiring the Web DataWindow
component on a component server but no PowerBuilder DLLs on the
client. - Web DataWindow DTC A design-time control used to represent the Web DataWindow
on a development machine. The DTC is an ActiveX control that generates
a set of instructions for the DataWindow component on a component
server. The component generates a Web DataWindow for display in
a client browser. The client browser does not need to support ActiveX
controls to display the Web DataWindow. - DataWindow Web control for ActiveX An ActiveX control for use on Web pages. The client browser
must support ActiveX controls to display a DataWindow object used
by this control - DataWindow, Java Edition A JavaBeans component for use in Java applications built in
PowerJ. - DataWindow plugin A browser plugin that displays Powersoft reports.
For a comparison of each of these environments, see “Choosing a DataWindow technology”.
In PowerBuilder and PowerJ, you can also use DataStore objects
as containers for a DataWindow object. DataStores provide DataWindow
functionality for retrieving and manipulating data without the onscreen
display. Uses for DataStores include specifying layouts for printing
and managing data in the server component of a distributed application.
What DataWindow objects are
A DataWindow object is an object that
you use to retrieve, present, and manipulate data from a relational
database or other data source (such as an Excel worksheet or dBASE
file). You can specify whether the DataWindow object supports updating
of data.
DataWindow objects have knowledge about the data they are
retrieving. You can specify display formats, presentation styles,
and other data properties to make the data meaningful to users.
In the DataWindow painter, you can also make Powersoft
report (PSR) files, which you can use in DataWindow
controls or components. A PSR file contains a report definition–essentially
a nonupdatable DataWindow object–as well as the data contained
in the report when the PSR file was created. It does not retrieve
data.
Report objects now obsolete Older versions of PowerBuilder had report objects as well
as DataWindow objects. A report object could retrieve but not update
data; it was essentially a nonupdatable DataWindow object. Report
objects are now obsolete.
Where to define DataWindow objects
You define DataWindow objects in the DataWindow painter in
PowerBuilder or DataWindow Builder. DataWindow Builder has all the
painters necessary for working with databases and defining DataWindows
without the overhead of a full PowerBuilder installation. It is
useful for developers whose main application development tool is
PowerJ.
You can also define nonupdatable DataWindow objects in the
InfoMaker Report painter.
Presentation styles and data sources
When you define a DataWindow object, you choose a presentation
style and a data source.
Presentation styles
A presentation style defines a typical style of report and
handles how rows are grouped on the page. You can customize the
way the data is displayed in each presentation style. The presentation
styles include:
| Presentation style | Description |
|---|---|
| Tabular | Data columns across the page and headers above each column. Several rows are viewable at once |
| Freeform | Data columns going down the page with labels next to each column. One row displayed at a time |
| Grid | Row-and-column format like a spreadsheet with grid lines. Users can move borders and columns |
| Label | Several labels per page with one row for each label. Used for mailing and other labels |
| N-Up | Two or more rows of data next to each other across the page. Useful for periodic data, such as data for each day of the week or each month in the quarter |
| Group | A tabular style with rows grouped under headings. Each group can have summary fields with computed statistics |
| Composite | Several DataWindow objects grouped into a single presentationNot supported by Web DataWindow |
| Graph | Graphical presentation of dataNot supported by Web DataWindow or DataWindow, Java Edition |
| Crosstab | Data summary in a row-and-column format |
| RichText | Paragraphs of text with embedded data columnsNot supported by Web DataWindow, Web control for ActiveX, or DataWindow, Java Edition |
| OLE | An OLE object linked or embedded in the DataWindow and associated with the retrieved dataNot supported by Web DataWindow or DataWindow, Java Edition |
For examples of the presentation styles, see the DataWindow
Builder User’s Guide
or the PowerBuilder
User’s Guide
.
Data sources
The data source specifies where the data in the DataWindow
comes from and what data items are displayed. Data can come from
tables in a database, or you can import data from a file or specify
the data in code. For databases, the data specification is saved
in a SQL statement. In all cases, the DataWindow object saves the
names of the data items to display, as well as their data types.
The data sources include:
| Data source | Description |
|---|---|
| Quick Select | The data is coming from one or more tables in a SQL database. The tables must be related through a foreign key. You need to choose only columns, selection criteria, and sorting |
| SQL Select | You want more control over the select statement that is generated for the data source. You can specify grouping, computed columns, and so on |
| Query | The data has already been selected and the SQL statement is saved in a query object that you have defined in the Query painter. When you define the DataWindow object, the query object is incorporated into the DataWindow and does not need to be present when you run the application |
| Stored procedure | The data is defined in a database stored procedure |
| External | The data is not stored in a database, but is imported from a file (such as a tab-separated or dBASE file) or populated from code |
Basic process
Using a DataWindow involves two main steps:
- Use the DataWindow painter in either DataWindow Builder or PowerBuilder
to create or edit a DataWindow object.
In the painter, you define the data source, presentation style,
and all other properties of the object, such as display formats,
validation rules, sorting and filtering criteria, and graphs. - In your development environment, put a DataWindow
control or component in a window, form, or Web page and associate
a DataWindow object with it.
It is through this control that your application communicates
with the DataWindow object you created in the DataWindow painter.
You write code to manipulate the DataWindow control and the DataWindow
object it contains. Typically, your code retrieves and updates data,
changes the appearance of the data, handles errors, and shares data
between DataWindow controls.