Rss & SiteMap
Foxtable(狐表) http://www.foxtable.com
If e.DataCol.Name = "住院号" Then
If e.DataRow("住院号") IsNot Nothing Then
Dim dr As DataRow = DataTables("长期医嘱").Find("[住院号] = '" & e.DataRow("住院号") & "' ")
If dr IsNot Nothing Then
Dim cf As DataRow = DataTables("收费项目").Find("项目名称 = '餐费标准'")
Dim jc As DataRow = DataTables("长期医嘱").Find("项目名称 = '诊疗费'And 执行 =1 And [住院号] = '" & e.DataRow("住院号") & "'")
e.DataRow("本月开嘱日期") = DataTables("长期医嘱").Compute("min(开嘱日期)","[住院号] = '" & e.DataRow("住院号") & "'")
e.DataRow("本月停嘱日期") = DataTables("长期医嘱").Compute("max(停嘱日期)","[住院号] = '" & e.DataRow("住院号") & "'")
e.DataRow("假出日期") =jc("停嘱日期")
Else
e.DataRow("本月开嘱日期") = Nothing
e.DataRow("本月停嘱日期") = Nothing
e.DataRow("假出日期") =Nothing
End If
End If
End If
问题出在红色字体的代码上,加了条件[住院号] = '" & e.DataRow("住院号") & "'后出现问题。
不管 执行 =1还是 执行 =true,代码分开写后,运行结果正确,代码如下:
If e.DataCol.Name = "住院号" Then
If e.DataRow("住院号") IsNot Nothing Then
Dim dr As DataRow = DataTables("长期医嘱").Find("[住院号] = '" & e.DataRow("住院号") & "' ")
Dim jc As DataRow = DataTables("长期医嘱").Find("项目名称 = '诊疗费'And 执行 =True And [住院号] = '" & e.DataRow("住院号") & "'")
If dr IsNot Nothing Then
Dim cf As DataRow = DataTables("收费项目").Find("项目名称 = '餐费标准'")
e.DataRow("本月开嘱日期") = DataTables("长期医嘱").Compute("min(开嘱日期)","[住院号] = '" & e.DataRow("住院号") & "'")
e.DataRow("本月停嘱日期") = DataTables("长期医嘱").Compute("max(停嘱日期)","[住院号] = '" & e.DataRow("住院号") & "'")
Else
e.DataRow("本月开嘱日期") = Nothing
e.DataRow("本月停嘱日期") = Nothing
End If
If jc IsNot Nothing Then
e.DataRow("假出日期") =jc("停嘱日期")
Else
e.DataRow("假出日期") =Nothing
End If
End If
End If
问题已升级,请高手指点:
如何找到第一行和最后一行
Dim jc As DataRow = DataTables("长期医嘱").Find("项目名称 = '诊疗费' And 执行 =True And [住院号] = '" & e.DataRow("住院号") & "'")
|
找出"长期医嘱"该住院号的第一个符合条件的数据,条件:项目名称= '诊疗费' 执行 =True
Dim n As Integer = DataTables("长期医嘱").Compute("count(住院号)","你的条件···")
'最后一行
Dim jc As DataRow = DataTables("长期医嘱").Find("项目名称 = '诊疗费' And 执行 =True And [住院号] = '" & e.DataRow("住院号") & "'","",n-1) |
如何找出第一行和最后一行,这里有说明:
http://www.foxtable.com/help/topics/0396.htm
如果如果不根据Find的时候,应该设置排序参数,例如按日期排序,可以找出最早和最迟的一行,按价格排序,可以找出最贵和最便宜的商品。
在没有排序参数的情况下,所谓的第一行和最后一行,是没有意义的。
如何找出第一行和最后一行,这里有说明:
http://www.foxtable.com/help/topics/0396.htm
如果如果不根据Find的时候,应该设置排序参数,例如按日期排序,可以找出最早和最迟的一行,按价格排序,可以找出最贵和最便宜的商品。
在没有排序参数的情况下,所谓的第一行和最后一行,是没有意义的。
谢谢老总,帮助中的例子好像不太适合。如果符合条件的数据只有一行呢?我本来就要查找日期的,现在又要用日期排序,显得多余。
在易表中使用参数“1”第一行,“-1”最后一行。狐表只能用排序的办法解决吗?