Foxtable(狐表)用户栏目专家坐堂 → 代码报错


  共有2639人关注过本帖树形打印复制链接

主题:代码报错

帅哥哟,离线,有人找我吗?
lgz518
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:五尾狐 帖子:1152 积分:7712 威望:0 精华:0 注册:2019/6/13 9:57:00
代码报错  发帖心情 Post By:2021/12/25 15:29:00 [只看该作者]

公式: < [(L+W)*2+4 ]  / 100 > * < [(W+H)*2)] / 100 > ,执行下面代码,报错
Select Case e.DataCol.Name
    Case "类别","规格"
        If e.DataRow.IsNull("类别") OrElse e.DataRow.IsNull("规格")  Then
            e.DataRow("面积") = Nothing
        Else
            Dim dr As DataRow 
             'dr= DataTables("表B").find("类别='" & e.DataRow("类别") & "'")
      
       dr= DataTables("表B").find("类别='" & e.DataRow("类别") & "'")

            If dr IsNot Nothing Then
                Dim str As String = dr("公式")
                str = str.Replace("附加数1",dr("附加数1")).Replace("附加数2",dr("附加数2"))
                Dim ar() As String = e.DataRow("规格").split("*")
                Dim pattern As String = "[^\d+.]"
                ar(0) = System.Text.RegularExpressions.Regex.Replace(ar(0), pattern ,"")
                str = str.Replace("L",ar(0))
                If ar.Length > 1 Then
                    ar(1) = System.Text.RegularExpressions.Regex.Replace(ar(1), pattern ,"")
                    str = str.Replace("W",ar(1))
                End If

        If ar.Length > 2 Then
                    ar(2) = System.Text.RegularExpressions.Regex.Replace(ar(2), pattern ,"")
                    str = str.Replace("H",ar(2))
                End If
        '
                e.DataRow("S") = eval(StrToNarrow(str))


            End If
        End If
End Select





问题一:应用上面公式和代码报错如下,如何解决?
问题二:上面代码是否有调用到“自定函数”呢?印象在没升时是有“自定函数”栏设定“自定函数”,现在升级,看不到,有如何查看“自定函数”?


.NET Framework 版本:4.0.30319.42000
Foxtable 版本:2021.12.16.888
错误所在事件:Eval函数计算错误,表达式为: < [(30.52+20.52)*2+4 ]  / 100 > * < [(20.52+10.5)*2)] / 100 > 
详细错误信息:
语法错误




 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106688 积分:542629 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2021/12/25 15:38:00 [只看该作者]

1、括号不成对
2、全部改为普通括号,去掉中括号尖括号

 回到顶部