Schultz’s PowerBuilder Notes

The Ol’ Hidden Items in the Dddw Problem Part II

We all eventually need to build a datawindow where the contents of a drop down list is dependent on the value of another column.

Filtering the available selections in the dddw for the current row is straight forward, just add the necessary filtering script in the RowFocusChanged and ItemChanged events.   (See DDDW Contents Based on the Value of Another Column for more information regarding this. ) But if you have a tabular view, problems may soon become apparent with dependent columns in some rows displaying code values instead of descriptions.

Continue reading

November 16, 2008 Posted by | Drop Down Data Window (DDDW) | , , , , , , , , , , , | 9 Comments

Data Model

This is the data model and data for examples.

Continue reading

November 16, 2008 Posted by | Drop Down Data Window (DDDW) | Leave a comment

Populating Dropdown DataWindows

When are DDDWs populated automatically?

  • A Retrieve() is issued and the DDDW does not have a result set
  • A row is Inserted

Continue reading

May 29, 2008 Posted by | 2. Datawindows, Drop Down Data Window (DDDW) | , | Leave a comment

The ol’ Hidden Item in the Dddw Problem

I have a dddw which hides certain items by setting the row height for these hidden rows to 0. This allows the column for other rows to still display the non-selectable dddw rows. But by using the arrow key or hotkeys (first letter of the description) the user can still select these rows which have a height of zero. Continue reading

May 15, 2008 Posted by | Drop Down Data Window (DDDW) | , , , , , , , , , , , | 1 Comment

DDDW Events

Actions to a DDDW are fired through the DataWindow’s pbm_command Event

Continue reading

May 15, 2008 Posted by | Drop Down Data Window (DDDW) | , , , , | Leave a comment

Working with DDDW Properties

The following example returns the display value for the dept_id column for the current row:

String ls_rownum., ls_return

ls_rownum =  String(dw_1.GetRow( ))
ls_return = dw_1.Describe(“Evaluate(‘LookUpDisplay(dept_id)’,” + ls_rownum + “)”)

Continue reading

May 13, 2008 Posted by | Drop Down Data Window (DDDW), Powerscript | , , , , , , , , , , , , , , | 1 Comment

DDDW Odds and Ends

Replacing the dddw dataobject

dw_parent.Modify( d_dddw_empsal_by_dept )

Getting the name of the dddw

ls_dddwname = idw_requestor.Describe(ls_columns[li_col] + “.dddwname”)

Datawindowchild as Instance variables

I had a window which had several columns which featured filtering and copying of dddw children data. After the datawindow refreshed its contents, this functionality no longer worked. I tracked this down to the fact that I was saving a reference to the dddw in an instance variable. Apparently, after the datawindow was refreshed, this reference was clobbered, and filtering or copying to this dddw resulted in an error. Oddly, another dddw reference was not clobbered. To solve this problem, I deleted the idwc and when I needed a reference to the dddw, I used a local variable.

DDDW display value must be unique

Sometimes users want the oddest things.

I had an interesting requirement where the user wanted the same display value for two different data values. When the drop down appeared, additional columns were viewed which made it clear which data value should be associated to the display value. The problem was that if the display value does not change, the itemchanged is not triggered and the item status does not change to xxxModified!. This was very surprising and hard to track down.

The solution was to make the display value unique. This was done be appending many blank spaces and then the data value to the display value. The blank padding pushes the data value, which the user does not want to see, out of view

Filter buffer inadvertently discarded

There is a PB bug (at least in 6.5, don’t know if was fixed in later versions) with filtering dddws. Sometimes, the filter buffer is discarded.

May 12, 2008 Posted by | Drop Down Data Window (DDDW) | , , , , , | Leave a comment


Use SetDetailHeight() to adjust the height of any rows in the dddw. Setting the height to zero will effectively remove the dddw item from view.

The hidden item still needs to be in the dddw so that the display value is shown on other rows. Note: the arrow key will allow the user to still select the hidden item. There is a superior way to hide dddw items which will be addressed in a later post.

//Do not allow the user to select Vacation from the dddw.
// Vacation must be created through Employee Home Page
dw_1.GetChild(“tm_off_cd”, ldwc_time_off_cd)
ldwc_time_off_cd.SetFilter(“cd_id = 1001”)  // filter out the non-vacation row, 1001 is code for vacation
ldwc_time_off_cd.SetDetailHeight(1, ldwc_time_off_cd.RowCount(), 0) // hide the vacation row
ldwc_time_off_cd.Filter //Unfiliter all rows, only the non-vacation rows are visible

May 12, 2008 Posted by | Drop Down Data Window (DDDW) | , , , , , , , , , | Leave a comment

Weird problem with dddw not applying filter when the user clicks on a different updateble column

In my app, if the user clicked on a new row for an updateable column, the dddw filter for pos_cd was not being applied. It would work if the user clicked on row outside any column, or on the pos_cd or rsrc_grp columns. Developed this workaround, added the following to the Clicked Event:

if IsValid(dwo) then
   if lower(dwo.type) <> "datawindow" then
       this.SetColumn('pos_cd' )
       this.SetColumn('dpt_nbr' ) // first column
   end if
   if Lower(dwo.type) = "column" and row > 0 then
      ls_name =
   end if
end if


integer li_col
long    ll_row

ll_row = this.GetRow()

if ll_row > 0 and this.RowCount() > 0 then
   li_col = this.GetColumn()
   if NOT IsNull(li_col) and li_col > 0 then
      this.SetColumn('pos_cd' )
   end if
end if 

May 10, 2008 Posted by | Drop Down Data Window (DDDW) | , , , , , , | Leave a comment