PowerBuilder, different DD list values for each row, another way

The Ol’ Hidden Items in the Dddw Problem Part II

Make a second copy of the Color column and have this always contain all the rows in its dddw.  This second column is never filtered.

When the row is not the current row, display the column with the unfiltered dddw and hide the filter column.  If the row is the current row, show the column with the filtered dddw, and hide the column with the dddw with all the possible rows.  To do this, add the following expression to the visibility attribute of the column with the dddw which gets filtered:

IF (CurrentRow() = GetRow(), 1, 0)

The column with the dddw which always contains all the values will have the following expression in its visibility attribute:

IF (CurrentRow() = GetRow(), 0, 1)

PowerBuilder, different DD list values for each row

Source http://www.pbdr.com/pbtips/dw/fltrdddw.htm

Step 1 – declare instance variables

boolean ib_dropdowndropped = False
boolean ib_dropdownredrawn = True

Step 2 – extend the pbm_dropdown event

ib_dropdowndropped = True
ib_dropdownredrawn = False
of_Filter(True)
ib_dropdownredrawn = True

Step 3 – extend the pbm_ncpaint event

If (ib_dropdowndropped And ib_dropdownredrawn) Then
 ib_dropdowndropped = False
 ib_dropdownredrawn = False
 of_Filter(False)
 ib_dropdownredrawn = True
End If

Step 4 – write the of_Filter (boolean ab_switch) subroutine

datawindowchild ldwc
long ll_getitemnumber
string ls_setfilter = ""

If (ab_switch) Then
 ll_getitemnumber = GetItemNumber(GetRow(), "order_status_id")
 If (ll_getitemnumber = 1) Then // cancelled -> cancelled
  ls_setfilter = "(order_status_id = 1)"
 ElseIf (ll_getitemnumber = 2) Then // confirmed -> confirmed
  ls_setfilter = "(order_status_id = 2)"
 ElseIf (ll_getitemnumber = 3) Then // new -> cancelled, new, pending
  ls_setfilter = "(order_status_id = 1) or (order_status_id = 3) or
(order_status_id = 4)"
 ElseIf (ll_getitemnumber = 4) Then // pending -> cancelled, confirmed,
pending
  ls_setfilter = "(order_status_id = 1) or (order_status_id = 2) or
(order_status_id = 4)"
 End If
End If

GetChild("order_status_id", ldwc)
ldwc.SetFilter(ls_setfilter)
ldwc.Filter()