以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 相邻行产品相同合并 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=88234) |
||||
-- 作者:lshshlxsh -- 发布时间:2016/7/29 14:54:00 -- 相邻行产品相同合并 请问一下 下一行产品 上下两行产品一样的如何设置跟踪号等于前后跟踪号合并?如图 此主题相关图片如下:1.png [此贴子已经被作者于2016/7/29 14:54:02编辑过]
|
||||
-- 作者:狐狸爸爸 -- 发布时间:2016/7/29 16:13:00 --
|
||||
-- 作者:lshshlxsh -- 发布时间:2016/7/30 7:39:00 -- 谢谢狐狸爸爸,但是像1,2和6,7,8行并相邻的 ,请问一下这样怎么区分? 此主题相关图片如下:5.bmp [此贴子已经被作者于2016/7/30 9:42:30编辑过]
|
||||
-- 作者:Hyphen -- 发布时间:2016/7/30 13:33:00 -- DataColChanged事件 Select Case e.DataCol.name Case "计划跟踪号","产品组合" Dim t As Table = Tables(e.DataTable.Name) Dim idx As Integer =t.FindRow(e.DataRow) If idx > -1 Then Dim min As Integer = idx-1 Dim max As Integer = idx+1 Dim nv As String = e.NewValue Dim ov As String = e.OldValue If e.DataCol.name = "计划跟踪号" Then nv = e.DataRow("产品组合") ov = e.DataRow("产品组合") End If Do While min >= 0 Dim r As Row = t.Rows(min) If r("产品组合") = nv OrElse r("产品组合") = ov Then min -= 1 Else Exit Do End If Loop min += 1 Do While max < t.Rows.Count Dim r As Row = t.Rows(max) If r("产品组合") = nv OrElse r("产品组合") = ov Then max += 1 Else Exit Do End If Loop max -= 1 Dim dr As Row = t.Rows(min) Dim f As Integer = min Dim gzh As String = dr("计划跟踪号") For i As Integer = min + 1 To max Dim r As Row = t.Rows(i) If r("产品组合") = dr("产品组合") Then gzh &= "," & r("计划跟踪号") Else For j As Integer = f To i-1 t.Rows(j)("跟踪号") = gzh Next f = i dr = r gzh = dr("计划跟踪号") End If Next For k As Integer = f To max t.Rows(k)("跟踪号") = gzh Next End If End Select |