[sql]  
sql=|SELECT top 200  WF_ProcessName,COUNT(*) as records ,SUM(case when WF_DocStatus='Current' then 1 else 0 end) as sends,SUM(case when WF_DocStatus='ARC' then 1 else 0 end) as archives FROM  [ce-linkOA].[dbo].[BPM_AllDocumentforcelink] where 1 = 1|  
  
               
dim subtemp as string
 
dim pid
[vb]  
if len(WF_document.khbh(0)) <> 0 and WF_document.khbh(0)<> "All" then  
        subtemp = WF_document.khbh(0)  
  
        pid= Split(subtemp,"#")  
        For i = LBound(pid , 1) To UBound(pid , 1)  
                  
             if   sign = "1" then                        
                     sql=sql+| and ( WF_ProcessUNID='|+Cstr(pid(i))+|' |  
                          sign="2"  
                  else  
                          sql=sql+" or  WF_ProcessUNID='"+Cstr(pid(i))+"' "  
             end if  
  
    NEXT i                       
            sql =sql+ ") "  
end if