以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]统计表达式不计算  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=119391)

--  作者:方丈
--  发布时间:2018/5/24 9:01:00
--  [求助]统计表达式不计算
请教,下面的代码为什么没反应?错在哪儿?

SystemReady = False
Try

For Each dr1 As DataRow In DataTables("评价表").Select("")
    dr1("评价总积分") = 0
Next     \'
            Dim Y1 As Single =e.Form.Controls("NumericComboBox1").value
            Dim H1 As Single =e.Form.Controls("NumericComboBox2").value
            Dim B1 As Single =e.Form.Controls("NumericComboBox3").value
            
            Dim Y2 As Single =e.Form.Controls("NumericComboBox4").value
            Dim H2 As Single =e.Form.Controls("NumericComboBox5").value
            Dim B2 As Single =e.Form.Controls("NumericComboBox6").value
            
            Dim Y3 As Single =e.Form.Controls("NumericComboBox7").value
            Dim H3 As Single =e.Form.Controls("NumericComboBox8").value
            Dim B3 As Single =e.Form.Controls("NumericComboBox9").value
            
            Dim Y4 As Single =e.Form.Controls("NumericComboBox10").value
            Dim H4 As Single =e.Form.Controls("NumericComboBox01").value
            Dim B4 As Single =e.Form.Controls("NumericComboBox02").value
            
            

 Dim dt As Table = Tables("评价表")  
    For m As Integer = 0 To dt.rows.count -1
     Dim jf As Single = 0    
        For n As Integer = 1 To 4  
              
            If dt.Rows(m)("评委" & n) = "优秀" Then
                jf  = Y & n    
            Else If dt.Rows(m)("评委" & n) = "不合格"
                jf = B & n
            Else If dt.Rows(m)("评委" & n) = "合格"
                jf  = H & n 
            End If
 dt.Rows(m)("评价总积分") = dt.Rows(m)("评价总积分") + jf  
       Next   

    Next
Catch ex As Exception
    MessageBox.Show("评价积分统计完成!")
End Try
SystemReady = True

--  作者:有点甜
--  发布时间:2018/5/24 9:14:00
--  

与其这样,你还不如给 NumericComboBox 命名为 y1、y2、y3 这样的名称呢,然后直接用,如

 


For Each dr1 As DataRow In DataTables("评价表").Select("")
    dr1("评价总积分") = 0
Next     \'
Dim dt As Table = Tables("评价表")
For m As Integer = 0 To dt.rows.count -1
    Dim jf As Single = 0
    For n As Integer = 1 To 4
       
        If dt.Rows(m)("评委" & n) = "优秀" Then
            jf  = e.form.controls("Y" & n).Value
        Else If dt.Rows(m)("评委" & n) = "不合格"
            jf = e.form.controls("B" & n).Value
        Else If dt.Rows(m)("评委" & n) = "合格"
            jf  = e.form.controls("H" & n).Value
        End If
        dt.Rows(m)("评价总积分") = dt.Rows(m)("评价总积分") + jf
    Next       
Next