Foxtable(狐表)用户栏目专家坐堂 → 求助


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

主题:求助

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


加好友 发短信
等级:一尾狐 帖子:407 积分:3087 威望:0 精华:0 注册:2014/6/10 11:31:00
回复:(大红袍)参考代码啊 Dim t As Table...  发帖心情 Post By:2016/4/18 10:16:00 [只看该作者]

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目8.table


 


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

时间排序后怎么不变成这样呢?


Dim t As Table = Tables("车751")   此处要是有很多车XXX表 这个地方该怎么写?
Dim mindate As Date = t.Compute("min(日期)", "日期 is not null")
Dim maxdate As Date = t.Compute("max(日期)", "日期 is not null")
Do While mindate <= maxdate
    If t.FindRow("日期 = #" & mindate & "#") < 0 Then
        Dim nr As Row = t.AddNew
        nr("日期") = mindate
        nr("车号") = "751"
        nr("支客户款") = 0
    End If
    mindate = mindate.AddDays(1)
Loop
Tables("车751").Sort = "日期"


 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  12楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/4/18 11:00:00 [只看该作者]

Dim tnames() As String = {"车751"}
For Each tname As String In tnames
Dim t As Table = Tables(tname)
Dim mindate As Date = t.Compute("min(日期)", "日期 is not null")
Dim maxdate As Date = t.Compute("max(日期)", "日期 is not null")
t.DataTable.ReplaceFor("_Sortkey", 9999, "日期 is null")
Dim i As Integer = 0
Do While mindate <= maxdate
    Dim nr As Row
    Dim idx As Integer =  t.FindRow("日期 = #" & mindate & "#")
    If idx < 0 Then
        nr = t.AddNew
        nr("日期") = mindate
        nr("车号") = "751"
        nr("支客户款") = 0
    Else
        nr = t.Rows(idx)
    End If
    nr("_Sortkey") = i
    i += 1
    mindate = mindate.AddDays(1)
Loop

Next


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


加好友 发短信
等级:一尾狐 帖子:407 积分:3087 威望:0 精华:0 注册:2014/6/10 11:31:00
回复:(大红袍)Dim tnames() As String = {"车751"}...  发帖心情 Post By:2016/4/18 12:57:00 [只看该作者]

Dim tnames() As String = {"车751"}  改成车鲁H7A751
For Each tname As String In tnames
Dim t As Table = Tables(tname)
Dim mindate As Date = t.Compute("min(日期)", "日期 is not null")
Dim maxdate As Date = t.Compute("max(日期)", "日期 is not null")
t.DataTable.ReplaceFor("_Sortkey", 9999, "日期 is null")
Dim i As Integer = 0
Do While mindate <= maxdate
    Dim nr As Row
    Dim idx As Integer =  t.FindRow("日期 = #" & mindate & "#")
    If idx < 0 Then
        nr = t.AddNew
        nr("日期") = mindate
        nr("车号") = "751" 改成鲁H7A751
        nr("支客户款") = 0
    Else
        nr = t.Rows(idx)
    End If
    nr("_Sortkey") = i
    i += 1
    mindate = mindate.AddDays(1)
Loop

Next

怎么别的车表没反应呢?

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

 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  14楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/4/18 14:28:00 [只看该作者]

Dim tnames() As String = {"车751", "车457", "车789"}
For Each tname As String In tnames
Dim t As Table = Tables(tname)
Dim mindate As Date = t.Compute("min(日期)", "日期 is not null")
Dim maxdate As Date = t.Compute("max(日期)", "日期 is not null")
t.DataTable.ReplaceFor("_Sortkey", 9999, "日期 is null")
Dim i As Integer = 0
Do While mindate <= maxdate
    Dim nr As Row
    Dim idx As Integer =  t.FindRow("日期 = #" & mindate & "#")
    If idx < 0 Then
        nr = t.AddNew
        nr("日期") = mindate
        nr("车号") = tname.Replace("车", "")
        nr("支客户款") = 0
    Else
        nr = t.Rows(idx)
    End If
    nr("_Sortkey") = i
    i += 1
    mindate = mindate.AddDays(1)
Loop

Next


 回到顶部
总数 14 上一页 1 2