当前位置: 代码迷 >> PB >> 怎么过滤
  详细解决方案

怎么过滤

热度:158   发布时间:2016-04-29 09:13:04.0
如何过滤
ls_filter = "(dd = '"+ sle_1.text+"')and (pm = '"+ sle_2.text+"') and (gz= '"+ sle_3.text+"') and (gg= '"+ sle_4.text+"')and (compute_1 = '"+ sle_5.text+"')"
//ls_filter = "(dd = '"+ ddlb_3.text+"')"
dw_1.setfilter(ls_filter)
dw_1.filter()
dw_1.retrieve()
在上面的过滤条件中,如何其中某一变量或某几个变量为空,如何实现只过滤其他非空条件,比如sle_1.text 为空,如何实现只过滤
ls_filter = "(pm = '"+ sle_2.text+"') and (gz= '"+ sle_3.text+"') and (gg= '"+ sle_4.text+"')and (compute_1 = '"+ sle_5.text+"')"

------解决方案--------------------
定义一个filter变量,如果过滤条件是空则不加入,不是则加入filter语句。
------解决方案--------------------
ls_filter = ""

if sle_2.text <> "" then
ls_filter = "pm = '"+ sle_2.text+"'"
end if

if sle_3.text <> "" then
ls_filter = ls_filter + " and gz = '"+ sle_3.text+"'"
end if

...



------解决方案--------------------
探讨
ls_filter = ""

if sle_2.text <> "" then
ls_filter = "pm = '"+ sle_2.text+"'"
end if

if sle_3.text <> "" then
ls_filter = ls_filter + " and gz = '"+ sle_3.text+"'"
end if

...
  相关解决方案