以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]成绩公式如何写? (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=91103) |
||||||||
-- 作者:大雪山 -- 发布时间:2016/9/29 14:32:00 -- [求助]成绩公式如何写? 按学号将课程名成绩横排到成绩1的公式怎么写?
|
||||||||
-- 作者:有点蓝 -- 发布时间:2016/9/29 14:50:00 -- 参考:http://www.foxtable.com/webhelp/scr/2965.htm |
||||||||
-- 作者:大雪山 -- 发布时间:2016/9/29 15:47:00 -- 1.多增加一个学号字段,这公式怎么改? 2.表B是临时表,想改成正常的
Dim dtb As New DataTableBuilder("表B") [此贴子已经被作者于2016/9/29 16:01:37编辑过]
|
||||||||
-- 作者:有点蓝 -- 发布时间:2016/9/29 16:21:00 -- 1、 For Each v As String In DataTables("成绩").GetValues("学号") Dim dr1 As DataRow = DataTables("成绩1").AddNew() dr1("学号") = v Dim drs As List(Of DataRow) = DataTables("成绩").Select("学号 = \'" & v & "\'") If drs.Count > 0 Then dr1("姓名") = drs(0)("姓名") For Each dr2 As DataRow In drs dr1(dr2("课程")) = dr2("成绩") Next End If Next MainTable = Tables("成绩1") 2、和1楼项目一样,先创建好表
|
||||||||
-- 作者:大雪山 -- 发布时间:2016/9/30 8:53:00 -- 加入学号出错,该如何修改?
Dim dtb As New DataTableBuilder("表B") MainTable = Tables("表B")
|
||||||||
-- 作者:blackzhu -- 发布时间:2016/9/30 9:00:00 -- 有没有学号呀? Dim dtb As New DataTableBuilder("表B") MainTable = Tables("表B") |
||||||||
-- 作者:大雪山 -- 发布时间:2016/10/3 12:24:00 --
表达式关联出错,问题如何解决操作呢?
|
||||||||
-- 作者:y2287958 -- 发布时间:2016/10/3 18:20:00 -- Dim bm As String = "统计表1" Dim b As New SQLGroupTableBuilder(bm,"成绩") b.Groups.AddDef("学号") b.Groups.AddDef("姓名") For Each kc As String In DataTables("成绩").GetValues("课程","课程 Is not null") b.Totals.AddExp(kc,"iif(课程=\'" & kc & "\',成绩,0)") Next b.Filter = "姓名 is not null" b.Build Tables(bm).AutoSizeCols MainTable = Tables(bm)
|
||||||||
-- 作者:大雪山 -- 发布时间:2016/10/6 17:37:00 --
EXCL 表中的buser字段的红色字部分添加到表中的修改公式?我做的加不进去. |
||||||||
-- 作者:有点蓝 -- 发布时间:2016/10/7 8:33:00 -- Dim dt As DataTable = DataTables("成绩") Dim Result As DialogResult Result = MessageBox.Show("确定要导入吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) If Result = DialogResult.Yes Then Dim dlg As New OpenFileDialog dlg.Filter = "Excel文件|*.xls" dlg.MultiSelect = True \'允许选择多个文件 If dlg.ShowDialog =DialogResult.OK Then Dim Book As New XLS.Book(dlg.FileName) Dim Sheet As XLS.Sheet = Book.Sheets("Sheet1") dt.ResumeRedraw() dt.StopRedraw() \'systemready = False Dim nms As New Dictionary(Of String, Integer) Dim dic As new Dictionary(Of DataRow, Integer) Dim ls As new List(Of Integer) For c As Integer = 0 To sheet.Cols.Count - 1 If dt.DataCols.Contains(sheet(0,c).Text.replace(" ", "")) Then nms.Add(sheet(0,c).Text.replace(" ", ""), c) End If Next For n As Integer = 1 To Sheet.Rows.Count -1 Dim sfzhm As String = sheet(n,nms("buser")).Text Dim bid As String = sheet(n,nms("bid")).Text If sfzhm = "" Then Continue For Dim dr As DataRow = dt.Find("buser = \'" & sfzhm & "\' and bid=\'" & bid & "\'") If dr Is Nothing Then ls.add(n) Else dic.Add(dr, n) End If Next For Each key As DataRow In dic.Keys For Each m As String In nms.keys If dt.DataCols(m).IsBoolean Then If Sheet(dic(key),nms(m)).Text = "" OrElse Sheet(dic(key),nms(m)).Text = "False" OrElse Sheet(dic(key),nms(m)).Value = 0 Then key(m) = False Else key(m) = True End If Else If dt.DataCols(m).Expression > "" Then \'表达式列 Else If dt.DataCols(m).IsNumeric Then key(m) = val(Sheet(dic(key),nms(m)).Value) Else If dt.DataCols(m).IsDate Then Dim d As Date If Date.TryParse(Sheet(dic(key),nms(m)).Value, d) key(m) = d End If Else key(m) = Sheet(dic(key),nms(m)).Value End If Next Next For Each l As Integer In ls Dim ndr As DataRow = dt.AddNew For Each m As String In nms.keys If dt.DataCols(m).IsBoolean Then If Sheet(l,nms(m)).Text = "" OrElse Sheet(l,nms(m)).Text = "False" OrElse Sheet(l,nms(m)).Value = 0 Then ndr (m) = False Else ndr (m) = True End If Else If dt.DataCols(m).Expression > "" Then \'表达式列 Else If dt.DataCols(m).IsNumeric Then ndr (m) = val(Sheet(l,nms(m)).Value) Else If dt.DataCols(m).IsDate Then Dim d As Date If Date.TryParse(Sheet(l,nms(m)).Value, d) ndr (m) = d End If Else ndr (m) = Sheet(l,nms(m)).Value End If Next Next dt.ResumeRedraw() \'systemready = True End If End If
|