以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]第一列字符重复数累计根据第一列数量更新  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=185180)

--  作者:miaoqingqing
--  发布时间:2023/2/9 9:39:00
--  [求助]第一列字符重复数累计根据第一列数量更新
求助,第一列字符重复数累计根据第一列数量更新
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:第一列字符重复数累计根据第一列数量更新.foxdb

版主,项目不能更新了,辛苦代码贴出来,谢谢
[此贴子已经被作者于2023/2/9 9:39:49编辑过]

--  作者:有点蓝
--  发布时间:2023/2/9 9:42:00
--  
用compute计算即可:http://www.foxtable.com/webhelp/topics/0393.htm,比如

Dim Total As Long
Total = 
DataTables("订单").Compute("Count(第一列)""第一列 = \'中国\'"
)
Output.Show(Total)

--  作者:miaoqingqing
--  发布时间:2023/2/9 10:16:00
--  回复:(有点蓝)用compute计算即可::http://www.fo...
蓝总,下面的代码怎么修改?

If  e.DataCol.name = "第一列" Then
    \'If e.DataRow.IsNull("四和") = False And e.DataRow("锁定") = False Then \'如果没有输入出生日期
    If e.DataRow("第一列")  IsNot Nothing Then \'如果没有输入出生日期
        
        \'Dim s As String = e.DataRow("第一列")
        Dim Products As List(Of String)
        Products = DataTables("表A").GetValues("第一列")
        For Each Product As String In Products
            Dim Total As Long 
            Total = DataTables("表A").Compute("Count(第一列)", "第一列 = Product ")
            e.DataRow("第一列字符重复数累计") = Total
            
        Next
        
    End If
    
End If



--  作者:有点蓝
--  发布时间:2023/2/9 10:23:00
--  
http://www.foxtable.com/webhelp/topics/1284.htm
--  作者:miaoqingqing
--  发布时间:2023/2/9 12:27:00
--  回复:(有点蓝)http://www.foxtable.com/webhelp/to...
蓝总,下面代码生成的值,怎么都是1?
If  e.DataCol.name = "第一列" Then
    \'If e.DataRow.IsNull("四和") = False And e.DataRow("锁定") = False Then \'如果没有输入出生日期
    \'If e.DataRow("第一列")  IsNot Nothing Then \'如果没有输入出生日期
    
    \'Dim s As String = e.DataRow("第一列")
    Dim Products As List(Of String)
    Products = DataTables("表A").GetValues("第一列")
    For Each Product As String In Products
        Dim Total As Long
        If e.DataRow("第一列")  IsNot Nothing Then \'如果没有输入出生日期
            Total = DataTables("表A").Compute("Count(第一列)", "第一列 = \'" & Product & "\' ")
            e.DataRow("第一列字符重复数累计") = Total
        End If
    Next
End If

--  作者:有点蓝
--  发布时间:2023/2/9 13:43:00
--  
If  e.DataCol.name = "第一列" Then
e.DataRow("第一列字符重复数累计") = e.DataTable.Compute("Count(第一列)", "第一列 = \'" & e.DataRow("第一列") & "\' ")
End If