以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  请问这是怎么回事呢?谢谢  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=103893)

--  作者:yangjing
--  发布时间:2017/7/19 11:30:00
--  请问这是怎么回事呢?谢谢

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


代码如下,在datacolchanged里执行

Select Case e.DataCol.Name
    Case "体重","身高"
       e.DataRow("BMI") = e.DataRow("体重") / (e.DataRow("身高") *e.DataRow("身高") ) * 10000
End Select

If e.DataCol.name = "BMI"
    If e.DataRow("BMI") < 0  OrElse e.DataRow("BMI") > 60
        MessageBox.show("对不起,实测数据不合法,请重新输入!")
        e.DataRow("BMI") = Nothing
        Return
    End If
End If

For Each r As Row In Tables("测试数据").rows
    If r.isnull("年龄") = False And r.isnull("性别") = False And r.isnull("BMI") = False Then
        Dim dr As DataRow = DataTables("BMI标准").find("性别 =\'" & r("性别") & "\' and 年龄下限 <= " & r("年龄") & " and 年龄上限 > " & r("年龄") & " and 数值下限 <= " & r("BMI") & " and 数值上限 > " & r("BMI") )
        If dr IsNot Nothing
            r("BMI评价") =  dr("评价")
        End If
    End If
Next


For Each r As Row In Tables("测试数据").rows
    If r.isnull("年龄") = False And r.isnull("性别") = False And r.isnull("握力") = False Then
        Dim dr As DataRow = DataTables("握力标准").find("性别 =\'" & r("性别") & "\' and 年龄下限 <= " & r("年龄") & " and 年龄上限 > " & r("年龄") & " and 数值下限 <= " & r("握力") & " And 数值上限 > " & r("握力") )
        If dr IsNot Nothing
            r("握力评价") =  dr("评价")
        End If
    End If
Next


For Each r As Row In Tables("测试数据").rows
    If r.isnull("年龄") = False And r.isnull("性别") = False And r.isnull("腰围") = False Then
        Dim dr As DataRow = DataTables("腰围标准").find("性别 =\'" & r("性别") & "\' and 年龄下限 <= " & r("年龄") & " and 年龄上限 > " & r("年龄") & " and 数值下限 <= " & r("腰围") & " And 数值上限 > " & r("腰围") )
        If dr IsNot Nothing
            r("腰围评价") =  dr("评价")
        End If
    End If
Next

For Each r As Row In Tables("测试数据").rows
    If r.isnull("年龄") = False And r.isnull("性别") = False And r.isnull("脉搏") = False Then
        Dim dr As DataRow = DataTables("脉搏标准").find("性别 =\'" & r("性别") & "\' and 年龄下限 <= " & r("年龄") & " and 年龄上限 > " & r("年龄") & " and 数值下限 <= " & r("脉搏") & " And 数值上限 > " & r("脉搏") )
        If dr IsNot Nothing
            r("脉搏评价") =  dr("评价")
        End If
    End If
Next

For Each r As Row In Tables("测试数据").rows
    If r.isnull("年龄") = False And r.isnull("性别") = False And r.isnull("收缩压") = False Then
        Dim dr As DataRow = DataTables("收缩压标准").find("性别 =\'" & r("性别") & "\' and 年龄下限 <= " & r("年龄") & " and 年龄上限 > " & r("年龄") & " and 数值下限 <= " & r("收缩压") & " And 数值上限 > " & r("收缩压") )
        If dr IsNot Nothing
            r("收缩压评价") =  dr("评价")
        End If
    End If
Next

For Each r As Row In Tables("测试数据").rows
    If r.isnull("年龄") = False And r.isnull("性别") = False And r.isnull("舒张压") = False Then
        Dim dr As DataRow = DataTables("舒张压标准").find("性别 =\'" & r("性别") & "\' and 年龄下限 <= " & r("年龄") & " and 年龄上限 > " & r("年龄") & " and 数值下限 <= " & r("舒张压") & " And 数值上限 > " & r("舒张压") )
        If dr IsNot Nothing
            r("舒张压评价") =  dr("评价")
        End If
    End If
Next

For Each r As Row In Tables("测试数据").rows
    If r.isnull("年龄") = False And r.isnull("性别") = False And r.isnull("肌肉量") = False Then
        Dim dr As DataRow = DataTables("肌肉量标准").find("性别 =\'" & r("性别") & "\' and 年龄下限 <= " & r("年龄") & " and 年龄上限 > " & r("年龄") & " and 数值下限 <= " & r("肌肉量") & " And 数值上限 > " & r("肌肉量") )
        If dr IsNot Nothing
            r("肌肉量评价") =  dr("评价")
        End If
    End If
Next

For Each r As Row In Tables("测试数据").rows
    If r.isnull("年龄") = False And r.isnull("性别") = False And r.isnull("骨量") = False Then
        Dim dr As DataRow = DataTables("骨量标准").find("性别 =\'" & r("性别") & "\' and 年龄下限 <= " & r("年龄") & " and 年龄上限 > " & r("年龄") & " and 数值下限 <= " & r("骨量") & " And 数值上限 > " & r("骨量") )
        If dr IsNot Nothing
            r("骨量评价") =  dr("评价")
        End If
    End If
Next

For Each r As Row In Tables("测试数据").rows
    If r.isnull("年龄") = False And r.isnull("性别") = False And r.isnull("内脏脂肪") = False Then
        Dim dr As DataRow = DataTables("内脏脂肪标准").find("性别 =\'" & r("性别") & "\' and 年龄下限 <= " & r("年龄") & " and 年龄上限 > " & r("年龄") & " and 数值下限 <= " & r("内脏脂肪") & " And 数值上限 > " & r("内脏脂肪") )
        If dr IsNot Nothing
            r("内脏脂肪评价") =  dr("评价")
        End If
    End If
Next

For Each r As Row In Tables("测试数据").rows
    If r.isnull("年龄") = False And r.isnull("性别") = False And r.isnull("基础代谢") = False Then
        Dim dr As DataRow = DataTables("基础代谢标准").find("性别 =\'" & r("性别") & "\' and 年龄下限 <= " & r("年龄") & " and 年龄上限 > " & r("年龄") & " and 数值下限 <= " & r("基础代谢") & " And 数值上限 > " & r("基础代谢") )
        If dr IsNot Nothing
            r("基础代谢评价") =  dr("评价")
        End If
    End If
Next


Select Case e.DataCol.Name
    Case "年龄","体内年龄"
       e.DataRow("体内年龄差值") = e.DataRow("年龄") - e.DataRow("体内年龄")
End Select

\'For Each r As Row In Tables("测试数据").rows
    \'If r.isnull("年龄") = False And r.isnull("性别") = False And r.isnull("体内年龄差值") = False Then
        \'Dim dr As DataRow = DataTables("体内年龄标准").find("性别 =\'" & r("性别") & "\' and 年龄下限 <= " & r("年龄") & " and 年龄上限 > " & r("年龄") & " and 数值 =\' " & r("体内年龄差值") )
        \'If dr IsNot Nothing
            \'r("体内年龄评价") =  dr("评价")
        \'End If
    \'End If
\'Next


For Each r As Row In Tables("测试数据").rows
    If r.isnull("年龄") = False And r.isnull("性别") = False And r.isnull("体水分") = False Then
        Dim dr As DataRow = DataTables("体水分标准").find("性别 =\'" & r("性别") & "\' and 年龄下限 <= " & r("年龄") & " and 年龄上限 > " & r("年龄") & " and 数值下限 <= " & r("体水分") & " And 数值上限 > " & r("体水分") )
        If dr IsNot Nothing
            r("体水分评价") =  dr("评价")
        End If
    End If
Next

For Each r As Row In Tables("测试数据").rows
    If r.isnull("年龄") = False And r.isnull("性别") = False And r.isnull("睁眼单脚站立") = False Then
        Dim dr As DataRow = DataTables("睁眼单脚站立标准").find("性别 =\'" & r("性别") & "\' and 年龄下限 <= " & r("年龄") & " and 年龄上限 > " & r("年龄") & " and 数值下限 <= " & r("睁眼单脚站立") & " And 数值上限 > " & r("睁眼单脚站立") )
        If dr IsNot Nothing
            r("睁眼单脚站立评价") =  dr("评价")
        End If
    End If
Next

For Each r As Row In Tables("测试数据").rows
    If r.isnull("年龄") = False And r.isnull("性别") = False And r.isnull("坐位体前屈") = False Then
        Dim dr As DataRow = DataTables("坐位体前屈标准").find("性别 =\'" & r("性别") & "\' and 年龄下限 <= " & r("年龄") & " and 年龄上限 > " & r("年龄") & " and 数值下限 <= " & r("坐位体前屈") & " And 数值上限 > " & r("坐位体前屈") )
        If dr IsNot Nothing
            r("坐位体前屈评价") =  dr("评价")
        End If
    End If
Next

For Each r As Row In Tables("测试数据").rows
    If r.isnull("年龄") = False And r.isnull("性别") = False And r.isnull("三十秒反复坐起") = False Then
        Dim dr As DataRow = DataTables("三十秒反复坐起标准").find("性别 =\'" & r("性别") & "\' and 年龄下限 <= " & r("年龄") & " and 年龄上限 > " & r("年龄") & " and 数值下限 <= " & r("三十秒反复坐起") & " And 数值上限 > " & r("三十秒反复坐起") )
        If dr IsNot Nothing
            r("三十秒反复坐起评价") =  dr("评价")
        End If
    End If
Next

For Each r As Row In Tables("测试数据").rows
    If r.isnull("年龄") = False And r.isnull("性别") = False And r.isnull("体脂率") = False Then
        Dim dr As DataRow = DataTables("体脂率标准").find("性别 =\'" & r("性别") & "\' and 年龄下限 <= " & r("年龄") & " and 年龄上限 > " & r("年龄") & " and 数值下限 <= " & r("体脂率") & " And 数值上限 > " & r("体脂率") )
        If dr IsNot Nothing
            r("体脂率评价") =  dr("评价")
        End If
    End If
Next

For Each r As Row In Tables("测试数据").rows
    If r.isnull("年龄") = False And r.isnull("性别") = False And r.isnull("TUG单任务") = False Then
        Dim dr As DataRow = DataTables("TUG单任务标准").find("性别 =\'" & r("性别") & "\' and 年龄下限 <= " & r("年龄") & " and 年龄上限 > " & r("年龄") & " and 数值下限 <= " & r("TUG单任务") & " And 数值上限 > " & r("TUG单任务") )
        If dr IsNot Nothing
            r("TUG单任务评价") =  dr("评价")
        End If
    End If
Next

For Each r As Row In Tables("测试数据").rows
    If r.isnull("年龄") = False And r.isnull("性别") = False And r.isnull("TUG双任务") = False Then
        Dim dr As DataRow = DataTables("TUG双任务标准").find("性别 =\'" & r("性别") & "\' and 年龄下限 <= " & r("年龄") & " and 年龄上限 > " & r("年龄") & " and 数值下限 <= " & r("TUG双任务") & " And 数值上限 > " & r("TUG双任务") )
        If dr IsNot Nothing
            r("TUG双任务评价") =  dr("评价")
        End If
    End If
Next

For Each r As Row In Tables("测试数据").rows
    If r.isnull("年龄") = False And r.isnull("性别") = False And r.isnull("十米步行Fast") = False Then
        Dim dr As DataRow = DataTables("十米步行Fast标准").find("性别 =\'" & r("性别") & "\' and 年龄下限 <= " & r("年龄") & " and 年龄上限 > " & r("年龄") & " and 数值下限 <= " & r("十米步行Fast") & " And 数值上限 > " & r("十米步行Fast") )
        If dr IsNot Nothing
            r("十米步行Fast评价") =  dr("评价")
        End If
    End If
Next

For Each r As Row In Tables("测试数据").rows
    If r.isnull("年龄") = False And r.isnull("性别") = False And r.isnull("六分钟步行") = False Then
        Dim dr As DataRow = DataTables("六分钟步行标准").find("性别 =\'" & r("性别") & "\' and 年龄下限 <= " & r("年龄") & " and 年龄上限 > " & r("年龄") & " and 数值下限 <= " & r("六分钟步行") & " And 数值上限 > " & r("六分钟步行") )
        If dr IsNot Nothing
            r("六分钟步行评价") =  dr("评价")
        End If
    End If
Next


[此贴子已经被作者于2017/7/19 11:36:58编辑过]

--  作者:有点蓝
--  发布时间:2017/7/19 12:16:00
--  
关闭重启项目即可
--  作者:yangjing
--  发布时间:2017/7/24 16:36:00
--  
版主您好,我碰到一个很奇怪的问题,看来看去找不到问题
麻烦您看看,谢谢
  
两个表结果如下

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

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

“肺活量评价”列无法评价,请问是哪里的问题,其他的评价又输正常的,一样的表结构和计算代码

代码如下:
For Each r As Row In Tables("测试数据").rows
    If r.isnull("年龄") = False And r.isnull("性别") = False And r.isnull("肺活量") = False Then
        Dim dr As DataRow = DataTables("肺活量标准").find("性别 =\'" & r("性别") & "\' and 年龄下限 <= " & r("年龄") & " and 年龄上限 > " & r("年龄") & " and 数值下限 <= " & r("肺活量") & " and 数值上限 > " & r("肺活量") )
        If dr IsNot Nothing
            r("肺活量评价") =  dr("评价")
        End If
    End If
Next



--  作者:有点甜
--  发布时间:2017/7/24 17:06:00
--  

看看是否等于的问题,比如 40岁、45岁的时候,会有问题。

 

Dim dr As DataRow = DataTables("肺活量标准").find("性别 =\'" & r("性别") & "\' and 年龄下限 <= " & r("年龄") & " and 年龄上限 >= " & r("年龄") & " and 数值下限 <= " & r("肺活量") & " and 数值上限 > " & r("肺活量") )


--  作者:yangjing
--  发布时间:2017/7/24 20:25:00
--  
年龄上和数值上的判断都是大于等下限,小于上限,就相当于都包含了临界值了,还有就是其他项目都正常,就是这个不对,代码都一样的,很奇怪

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

[此贴子已经被作者于2017/7/24 20:25:56编辑过]

--  作者:yangjing
--  发布时间:2017/7/24 20:32:00
--  
版主说的对的,标准表在做的时候回漏掉年龄段了,谢谢