Switch to standard view 
  Sybase logo
 
 
 



Creating a Composite DataWindow Using an External Data Source

This procedure will only work for the first level datawindow in a composite report. This can be applied to as many reports as are on a composite datawindow as long as they are only one level from the base report.

Only one handle through a report chain can be gotten at any one time.

Defining the DataWindow

To create a datawindow that does not get its data from a native connection to a database nor from an ODBC intrface to a database, it is necessary to define a new source of data. This datasource is external to Powerbuilder and is defined by picking the External option in the datawindow painter process.

· Click on Datawindow, New, external, and the type of datawindow to be defined.
· A Result Set description box displays with definitions for each of the columns in the source file
· Each name and type of column must be defined. Types are taken from the drop down list box.

As an example, let the datawindow show three columns:

Name Department Employee Number

Smith Finance 2304
Jones Finance 2305
Mendez Corporate 1206
Washington Engineering 4503

Defining the Source File
 

The file is defined in regular text mode using an editor such as notepad or a Dos Editor

The columns must be delimited by a tab, otherwise no data will be imported.

The important thing is, however, that the width of the columns must be stretched wide enough in the datawindow to accommodate the width of the fields.

The file (file.txt) as defined by a text editor will be:

Smith Finance 2304
Jones Finance 2305
Mendez Corporate 1206
Washington Engineering 4503

The space between the columns must be a tab.
 

Defining the Composite Report
 

The composite report is defined in the regular method.

Using the datawindow painter, define the composite report by choosing the appropriate action.
 

· Click on Datawindow, New, Composite.
· Choose the reports(datawindows) to be included in the composite report)
· Click OK and the report will be generated.
 
 

The following code can be used to put data into two datwindows of a composite report after each is defined by getting the handle using a getchild() function:
 

DataWindowChild state_child,state_child2

integer rtncode,rtncode2

// Get data for first composite report named "r1"

rtncode = dw_1.GetChild('r1', state_child)
IF rtncode = -1 THEN MessageBox( &
"Error", "Not a DataWindowChild")
state_child.importfile("c:\aaatest\file.txt")
end if

// Get data for second composite report named "r2"

rtncode2 = dw_1.GetChild('r2', state_child2)
IF rtncode = -1 THEN MessageBox( &
"Error", "Not a DataWindowChild")
state_child2.importfile("c:\aaatest\file.txt")
end if



Back to Top
© Copyright 2010, Sybase Inc.