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()

Leave a Reply

Your email address will not be published. Required fields are marked *