Schultz’s PowerBuilder Notes

Groups and Grouping

How do I dynamically change a group property?

ll_color = RGB(200, 200, 500)

dw_1.Modify(“DataWindow.Header.2.Color=” + String(ll_color))


Continue reading


May 25, 2008 Posted by | Datawindow PowerScript, Presentation Styles | , , , , , , , , , , , , , , , , , | 4 Comments

Rich Text

A rich text DataWindow allows you to

  • Define a result set for the DataWindow
  • Retrieve info into the DataWindow
  • Update data
  • Add a limited number of objects to the DataWindow
  • Set DataWindow column properties

A rich text DW is best used for display-only reports, especially mail-merge documents. However, if you want, you can specify validation rules and display formats for the input fields

Continue reading

May 10, 2008 Posted by | Presentation Styles | , , , , , , , | Leave a comment


A crosstab report presents data in a row and column format. Because cells in a crosstab report are calculated, they cannot be updated by users.

Static Crosstab

Columns and rows are established based on data in the database when the crosstab is defined. Subsequent executions do nto change the number of rows and columns, only the values change

Dynamic Crosstab

All column and rows are built during execution based on current data in the database. Both the number of rows and columns and the values contained in the report can change.

May 10, 2008 Posted by | Presentation Styles | , , , , | Leave a comment


What is the difference between Value, Category and Series?

  • Value is the dependent variables (y axis)
  • Category is the by component (x axis)
  • Series is the third component in a 3D graph (z axis)

How do I use the ObjectAtPointer( ) function?

The ObjectAtPointer( ) function will allow the user to drill down on clicked graph data. It has three arguments: GraphObject, SeriesNumber, and DataPoint.

The following script is for a datawindow control’s clicked event. It identifies what graph object was clicked, if it is a category or value, it retireves the data in a second DataWindow based o the passed argument.

GrObjectType    ClickedObject
Long        ll_dept_num
String        ls_deptnum
Integer        li_ret, li_series, li_category
ClickedObject = this.ObjectAtPointer(‘gr_1’, li_series, li_category)
//If the userr clicked data or category, find out which one and retrieve second dw  with argument
IF ClickedObject = TypeData! OR ClickedObject = TypeCategory! THEN
   Ls_deptnum = this.CategoryName(‘gr_1’, li_category)
   Ll_deptnum = long(ls_deptnum)
   Dw_detail.title = “Employees in dept “ + ls_deptnum
   Dw_detail.Retrieve(ll_deptnum) )
   MessageBox(parent.title, “Click a department to see employee names”)

May 9, 2008 Posted by | Presentation Styles | , , , , | Leave a comment

Grid Style


You can prevent the user from moving columns in a grid

Dw_1.Object.DataWindow.Grid.ColumnMove = ‘no’

You can also control where grid lines are displayed

Dw_1.object.DataWindow.Grid.lines = 2 // 0 – always, 1 – never, 2 – display only, 3 print only

How do I get rid of the grid lines?

Starting with version 5, PB allows you to turn off the lines on a grid datawindow. To do this from the datawindow painter, set the datawindow property (click on the dw background, not on a column of text field) GRID and DISPLAY on the GENERAL tab.

To change the lines at run time, use the following

May 9, 2008 Posted by | Presentation Styles | , , , | Leave a comment

Composite DataWindow

What is a composite report?

A composite report contains other reports based on independent SQL statements. The composite report itself has no data source; it is just a container for the reports nested within it. The nested reports are not related to each other. However you can define retrieval arguments for the composite report and use them to control which rows each nested report retrieves.

Composite reports allow you to print the data for multiple DataWindows together.

To access data on a composite report use the GetChild function.

Datawindowchild ldwc_child
Dw_1.GetChild(“r_report”, ldwc_child)
Ldwc_child.function( )

What does the “Train the Footer” property of a nested report do?

This controls the placement of the footer for the last page of a nested report. When set, the footer will appear directly under the nested dw, not at the bottom of the page.

How do I modify an item on a composite window’s child?

In the following example, d_data is the name of the datawindow child as it appears in the composite datawindow, D_data is NOT a variable of type datawindowchild:

Dw_utilization_report.object.d_data.object.t_impressions.text = “xxx”

I have a composite DataWindow with three child DataWindows one of which is doing a ShareData with a datastore. When I retrieve, I get a GPF.

Do the ShareData after the Retrieve()

May 9, 2008 Posted by | 2. Datawindows, Presentation Styles | , , , , , , | 2 Comments

Nested Report

What is a nested report?

A report can nest another report as an object within it. This can be useful for representing master/detail information. For each master row, a separate retrieve is done for each detail row. So a report with 20 master rows involves 21 retrieves.

Detail rows can relate the nested report to the base report via retrieval arguments or retrieval criteria.

To access nested data use something like this:


The GetChild function will work for composite reports but not for nested ones.

The big pain about nested reports is that they have no current row, so a GetRow() will always return 0. So getting information can not be pinpointed with a mouse click. The row in the clicked event will refer to the container’s row, not the nested report’s row.

How do I determine if a datawindow contains nested Reports, i.e. is a Base Report (container datawindow)?




May 9, 2008 Posted by | 2. Datawindows, Presentation Styles | , , | 2 Comments

Which presentation styles are used for reporting only?

Reporting Only

Reporting and Updating









OLE 2.0



May 9, 2008 Posted by | Presentation Styles | , , , , , , , , | Leave a comment