以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [讨论]自动执行公式无法执行  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=123776)

--  作者:wumingrong1
--  发布时间:2018/8/22 18:18:00
--  [讨论]自动执行公式无法执行

在表的【DataColChanged】中写有以下命令;如果是直接在【宽带帐号】中手工填入内容就可以生效;如果【宽带帐号】是通过命令从【客户投诉故障情况】这个字段中通过命令提取后自动填入到【宽带帐号】中;命令就无法生效。该怎么处理?

 

Select Case e.DataCol.name

Case "宽带帐号","客户投诉故障情况"
e.DataRow("光端口状态") = Nothing

Dim dr1 As DataRow  = DataTables("资源不准确整改清单表").sqlFind("宽带帐号 =  \'" & e.DataRow("宽带帐号") & "\'  and  光端口状态 is not null  and 工单类型 = \'桥接改路由整改工单\' ")
If dr1 IsNot Nothing Then \'如果找到了同名的产品行,也就是dr不是Nothing
e.DataRow("光端口状态") &= " / 光猫桥接关闭光端口"
MessageBox.show("该宽带帐号被【光猫桥接整改】关闭光端口,关闭原因请看【光端口状态】内容!!!", "非常关键提醒")
End If
                                                                                       
dr1 = DataTables("资源不准确整改清单表").sqlFind("宽带帐号 =  \'" & e.DataRow("宽带帐号") & "\'  and  光端口状态 is not null  and 工单类型 = \'无线电视整改工单\' ")
If dr1 IsNot Nothing Then \'如果找到了同名的产品行,也就是dr不是Nothing
e.DataRow("光端口状态") &= " / 电视无线关闭光端口"
MessageBox.show("该宽带帐号被【电视无线整改】关闭光端口,关闭原因请看【光端口状态】内容!!!", "非常关键提醒")
End If
                                                                                       
dr1 = DataTables("弱光整治清单表").sqlFind("宽带帐号 =  \'" & e.DataRow("宽带帐号") & "\'  and  光端口状态 is not null  ")
If dr1 IsNot Nothing Then \'如果找到了同名的产品行,也就是dr不是Nothing
e.DataRow("光端口状态") &= " / 存量弱光关闭光端口"
MessageBox.show("该宽带帐号被【处理工单弱光整改】关闭光端口,关闭原因请看【光端口状态】内容!!!", "非常关键提醒")
End If
                                                                                       
dr1 = DataTables("新装弱光整治清单表").sqlFind("宽带帐号 =  \'" & e.DataRow("宽带帐号") & "\'  and  光端口状态 is not null  ")
If dr1 IsNot Nothing Then \'如果找到了同名的产品行,也就是dr不是Nothing
e.DataRow("光端口状态") &= " / 新装弱光关闭光端口"
MessageBox.show("该宽带帐号被【新装弱光整改】关闭光端口,关闭原因请看【光端口状态】内容!!!", "非常关键提醒")
End If
                                                                                       
End Select


--  作者:有点蓝
--  发布时间:2018/8/22 20:18:00
--  
通过命令从【客户投诉故障情况】这个字段中通过命令提取后自动填入到【宽带帐号】中

    -- 通过什么命令,怎么填入的?写了什么代码?

--  作者:wumingrong1
--  发布时间:2018/8/23 9:02:00
--  

在表的【DataColChanged】中写有以下命令; 实际运行中能够正常截取所需的内容。

 

 

    If  Forms("投诉受理组维护窗口(10086)").Opened Then
        Select Case e.DataCol.name
            Case "客户投诉故障情况"
                Dim r As Row = Tables("投诉工单清单表").current

                    If  r("客户投诉故障情况") Like "*宽带账户:*"  Then
                        \'msgbox(1)
                        Dim mc3 = System.Text.RegularExpressions.Regex.Matches(r("客户投诉故障情况"),"宽带账户.+\\n")
                        \'  Dim s As String = mc3(0).value
                        r("宽带帐号") = mc3(0).value.Substring(5)
                        r("宽带帐号") = r("宽带帐号").Replace("@139.gd","")
                                             
                    Else
                        If  r("客户投诉故障情况") Like "*宽带账号:*"  Then
                            \'msgbox(1)
                            Dim mc4 = System.Text.RegularExpressions.Regex.Matches(r("客户投诉故障情况"),"宽带账号.+\\n")
                            \'  Dim s As String = mc3(0).value
                            r("宽带帐号") = mc4(0).value.Substring(5)
                            r("宽带帐号") = r("宽带帐号").Replace("@139.gd","")
                                                      
                        Else
                            If  r("客户投诉故障情况") Like "*客户账号:*"  Then
                                \'msgbox(1)
                                Dim mc5 = System.Text.RegularExpressions.Regex.Matches(r("客户投诉故障情况"),"客户账号.+\\n")
                                \'  Dim s As String = mc3(0).value
                                r("宽带帐号") = mc5(0).value.Substring(5)
                                r("宽带帐号") = r("宽带帐号").Replace("@139.gd","")
                                                             
                            Else
                                e.DataRow("宽带帐号") = Nothing
                            End If
                        End If
                    End If
                    
                      
                    
                End If
               
               
            End  Select
           
        Else
        End If

 

 

 


图片点击可在新窗口打开查看此主题相关图片如下:微信图片_20180823090021.png
图片点击可在新窗口打开查看

图片点击可在新窗口打开查看此主题相关图片如下:微信图片_20180823090038.png
图片点击可在新窗口打开查看

--  作者:有点蓝
--  发布时间:2018/8/23 9:15:00
--  
3楼代码最后加上这句试试

Tables("投诉工单清单表").FinishEditing

--  作者:wumingrong1
--  发布时间:2018/8/23 10:06:00
--  

加了还是不行

 

 

 If  Forms("投诉受理组维护窗口(10086)").Opened Then
        Select Case e.DataCol.name
            Case "客户投诉故障情况"
                Dim r As Row = Tables("投诉工单清单表").current
                If  r("工单类型") = "10086工单" And  e.DataRow("客户投诉故障情况") = Nothing  Then
                    e.DataRow("客户姓名") = Nothing
                    e.DataRow("客户联系方式") = Nothing
                    e.DataRow("宽带帐号") = Nothing
                    e.DataRow("客户地址") = Nothing
                Else
                   
                    If  r("客户投诉故障情况") Like "*客户姓名*"  Then
                        Dim mc1 = System.Text.RegularExpressions.Regex.Matches(r("客户投诉故障情况"),"客户姓名.+\\n")
                        \' msgbox(mc1(0).value.Substring(5))
                        r("客户姓名") = mc1(0).value.Substring(5)
                    Else
                        If  r("客户投诉故障情况") Like "*客户名称*"  Then
                            Dim mc2 = System.Text.RegularExpressions.Regex.Matches(r("客户投诉故障情况"),"客户名称.+\\n")
                            \' msgbox(mc1(0).value.Substring(5))
                            r("客户姓名") = mc2(0).value.Substring(5)
                        Else
                            e.DataRow("客户姓名") = Nothing
                        End If
                    End If
                   
                   
                    If  r("客户投诉故障情况") Like "*电视账号*"  Then
                        Dim mc1 = System.Text.RegularExpressions.Regex.Matches(r("客户投诉故障情况"),"电视账号.+\\n")
                        \' msgbox(mc1(0).value.Substring(5))
                        r("电视账号") = mc1(0).value.Substring(5)
                       
                    Else
                        e.DataRow("电视账号") = Nothing
                    End If
                   
                   
                   
                    If  r("客户投诉故障情况") Like "*宽带账户:*"  Then
                        \'msgbox(1)
                        Dim mc3 = System.Text.RegularExpressions.Regex.Matches(r("客户投诉故障情况"),"宽带账户.+\\n")
                        \'  Dim s As String = mc3(0).value
                        r("宽带帐号") = mc3(0).value.Substring(5)
                        r("宽带帐号") = r("宽带帐号").Replace("@139.gd","")
                                            
                    Else
                        If  r("客户投诉故障情况") Like "*宽带账号:*"  Then
                            \'msgbox(1)
                            Dim mc4 = System.Text.RegularExpressions.Regex.Matches(r("客户投诉故障情况"),"宽带账号.+\\n")
                            \'  Dim s As String = mc3(0).value
                            r("宽带帐号") = mc4(0).value.Substring(5)
                            r("宽带帐号") = r("宽带帐号").Replace("@139.gd","")
                                                     
                        Else
                            If  r("客户投诉故障情况") Like "*客户账号:*"  Then
                                \'msgbox(1)
                                Dim mc5 = System.Text.RegularExpressions.Regex.Matches(r("客户投诉故障情况"),"客户账号.+\\n")
                                \'  Dim s As String = mc3(0).value
                                r("宽带帐号") = mc5(0).value.Substring(5)
                                r("宽带帐号") = r("宽带帐号").Replace("@139.gd","")
                                                           
                            Else
                                e.DataRow("宽带帐号") = Nothing
                            End If
                        End If
                    End If
                   
                   
                   
                    If  r("客户投诉故障情况") Like "*用户联系号码*"  Then
                        Dim mc2 = System.Text.RegularExpressions.Regex.Matches(r("客户投诉故障情况"),"用户联系号码.+\\n")
                        \' msgbox(mc1(0).value.Substring(5))
                        r("客户联系方式") = mc2(0).value.Substring(7)
                        \'  Dim mc3 = System.Text.RegularExpressions.Regex.Matches(r("客户投诉故障情况"),"宽带账号.+@139.gd")
                    Else
                        e.DataRow("客户联系方式") = Nothing
                    End If
                   
                   
                   
                   
                    If  r("客户投诉故障情况") Like "*宽带安装地址*"  Then
                        Dim mc4 = System.Text.RegularExpressions.Regex.Matches(r("客户投诉故障情况"),"宽带安装地址.+")
                        \' msgbox(mc1(0).value.Substring(5))
                        r("客户地址") = mc4(0).value.Substring(7)
                    Else
                        e.DataRow("客户地址") = Nothing
                    End If
                   
                   
                End If
               
               
            End  Select
           Tables("投诉工单清单表").FinishEditing 
        Else
        End If

[此贴子已经被作者于2018/8/23 10:06:34编辑过]

--  作者:有点蓝
--  发布时间:2018/8/23 10:09:00
--  
窗口表是什么类型。控件绑定的是窗口表还是主表?
--  作者:wumingrong1
--  发布时间:2018/8/23 14:31:00
--  

主表


图片点击可在新窗口打开查看此主题相关图片如下:360截图20180823143433658.jpg
图片点击可在新窗口打开查看

[此贴子已经被作者于2018/8/23 14:35:00编辑过]

--  作者:有点蓝
--  发布时间:2018/8/23 14:43:00
--  
Select Case e.DataCol.name
            Case "客户投诉故障情况"
                Dim r As dataRow = e.DataRow
                If  r("工单类型") = "10086工单" And  e.DataRow("客户投诉故障情况") = Nothing  Then

如果不行做个例子过来看看吧

--  作者:wumingrong1
--  发布时间:2018/8/23 15:30:00
--  


图片点击可在新窗口打开查看此主题相关图片如下:360截图20180823152627636.jpg
图片点击可在新窗口打开查看


 


图片点击可在新窗口打开查看此主题相关图片如下:360截图20180823152824732.jpg
图片点击可在新窗口打开查看

 

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目1.foxdb


--  作者:有点蓝
--  发布时间:2018/8/23 15:49:00
--  
r("宽带帐号") = mc3(0).value.Substring(5).Replace(vbcrlf,"")

正则提取出来是包含换行符的,要去掉