Hello,
I'm having trouble with .setfilter function. Well, I manage to make it work. What seems to be my problem is that I have a dropdown list and a datawindow. Everytime I clicked or picked on that dropdown the value will filter in my datawindow and I have that "ALL" item on my dropdown list when I picked that supposed to be it will go back to the original data in the datawindow which didn't filter anything but it's showing nothing. I know I'm missing some logic on my script. Any help would be very much appreciated. Thank you so much!
Here is what I have. I attached the image also for your reference.
string s_colname, s_criteria, s_null, s_dtefrom, s_dteto, ls_datefrom, ls_dateto, ls_filter, s_sysrefno
datetime dt_from,dt_to
long l_count, l_row
int i_sort
datawindowchild dwc_child, dwc_station
s_colname = this.getcolumnname()
this.accepttext()
setnull(s_null)
Choose case s_colname
case "station"
this.accepttext()
is_station = this.getitemstring(1,'station')
// in this part what im trying to do is to reload the datawindow without the filter.
if is_station = '' or isnull(is_station) or is_station = '000' then
messagbox("",is_station)dw_activate_spots.retrieve(is_sysrefno)
//dw_activate_spots.reset()
return
end if
this.getchild('station',dwc_station)
s_criteria = is_station
dw_activate_spots.SetFilter("ordd_stncde = '"+ s_criteria +" '")
dw_activate_spots.filter()
// "ordd_stncde = '"+ is_station +" '"+ " AND " + "ordd_teledte >= Date('" + String(idt_from, "mm/dd/yyyy") + "')" + " AND " + " ordd_teledte <= Date('" + String(idt_to, "mm/dd/yyyy") + "')"
end choose
If you have not yet done so, I suggest you review the PB Help topics on the SetFilter and Filter DataWindow functions and learn all you can about them.