string ls_oldsql
string ls_f
string ls_temp_1
long ll_p
ls_f = ls_newsql
ls_oldsql=ldw_in.object.datawindow.table.select
ls_temp_1=lower(trim(ls_oldsql))
if pos(ls_temp_1,"where")=0 then ls_newsql =""+ "where "+"" + ls_newsql
if pos(ls_temp_1,"where")>0 then
ls_newsql=ls_oldsql+""+" and "+""+ls_newsql
else
ls_newsql=ls_oldsql+ls_newsql
end if
if lower(ls_f) = 'nowhere' then
ll_p = pos(lower(ls_newsql),'where')
if ll_p > 0 then
ls_newsql = left(ls_newsql,ll_p - 1)
end if
end if
if ls_newsql<>'' then
ldw_in.object.datawindow.table.select=ls_newsql
setpointer(hourglass!) //沙漏形状
if lower(ls_f) = 'nowhere' then
ldw_in.retrieve('nowhere')
else
ldw_in.retrieve()
end if
setpointer(arrow!)
ldw_in.object.datawindow.table.select=ls_oldsql
end if