dataWindow实现无控件左右内容的移动时去重

 1 > 添加时去重 ,数量汇总

long ll_rowcount,i,ll_find,ll_newrow
string ls_spdm
dec ld_sl

ll_rowcount=dw_1.rowcount()
for i=1 to ll_rowcount
    ls_spdm=dw_1.object.spdm[i]
    ld_sl=dw_1.object.sl[i]

     if dw_2.rowcount()>0 then
          ll_find=dw_2.find("spdm='"+ls_spdm+"'",1,dw_2.rowcount())
           //发现同时累加数量
        if ll_find>0 then
           dw_2.object.sl[ll_find]=dw_2.object.sl[ll_find]+ld_sl
        else
            ll_newrow=dw_2.insertrow(0)
            dw_2.setitem(ll_newrow,'spdm',ls_spdm)
            dw_2.setitem(ll_newrow,'sl',ld_sl)
        end if
     else
          ll_newrow=dw_2.insertrow(0)
          dw_2.setitem(ll_newrow,'spdm',ls_spdm)
         dw_2.setitem(ll_newrow,'sl',ld_sl)
    end if
next

 

     

posted @ 2015-01-22 20:42  jerry1209  阅读(154)  评论(0编辑  收藏  举报