以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 多值字段取值 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=87145) |
-- 作者:dy6608 -- 发布时间:2016/7/4 19:53:00 -- 多值字段取值 请教各位老师: 我的("数据导入源")表中有颜色列字段是多值字段,如(红,黄,绿),下列代码怎样取颜色列里的红,黄,绿 For Each dr As DataRow In DataTables("数据导入源").Select("[大类] =\'成品\'") Dim xxs As List(Of String) xxs = DataTables("产品").GetValues("物料编码", "[规格型号] = \'" & dr("规格型号") & "\'and [颜色] in(\'红,黄,绿多值字段\'") 谢谢 |
-- 作者:大红袍 -- 发布时间:2016/7/4 20:05:00 -- For Each dr As DataRow In DataTables("数据导入源").Select("[大类] =\'成品\'") Dim xxs As List(Of String) xxs = DataTables("产品").GetValues("物料编码", "[规格型号] = \'" & dr("规格型号") & "\' and [颜色] in(\'" & dr("颜色").replace(",", "|") & "\'") Next |
-- 作者:dy6608 -- 发布时间:2016/7/4 20:41:00 -- 老师:取不到颜色值啊,且不是要替换 For Each dr As DataRow In DataTables("数据导入源").Select("[大类] =\'成品\'") Dim xxs As List(Of String) xxs = DataTables("产品").GetValues("物料编码", "[规格型号] = \'" & dr("规格型号") & "\' and [颜色] in(\'" & dr("颜色").replace(",", "|") & "\'") For Each xx As String In xxs Dim dr2 As DataRow = DataTables("产品结构").AddNew() dr2("物料编码") = xx NextNext DataTables("产品结构")取不到值 谢谢! |
-- 作者:大红袍 -- 发布时间:2016/7/4 21:19:00 -- For Each dr As DataRow In DataTables("数据导入源").Select("[大类] =\'成品\'") Dim xxs As List(Of String) xxs = DataTables("产品").GetValues("物料编码", "[规格型号] = \'" & dr("规格型号") & "\'") For Each xx As String In xxs For Each ys As String In dr("颜色").split(",") Dim dr2 As DataRow = DataTables("产品结构").AddNew() dr2("物料编码") = xx dr2("颜色") = ys Next Next Next |
-- 作者:dy6608 -- 发布时间:2016/7/4 22:01:00 -- 老师:这样取到的值是("数据导入源")中所有产品颜色对应("产品")表中的产品,并不是("数据导入源")中某行产品颜色列对应的颜色产品 |
-- 作者:dy6608 -- 发布时间:2016/7/4 22:13:00 -- 老师:我是这样的,能达到目的,能否考虑用字典的方法,请指教 For Each dr As DataRow In DataTables("数据导入源").Select("[大类] =\'成品\'") Dim xxs As List(Of String) Dim yss() As String = dr("颜色").Split(",") For Each ys As String In nms xxs = DataTables("产品").GetValues("物料编码", "[规格型号] = \'" & dr("规格型号") & "\'and [大类] = \'线芯\'and [颜色] = \'" & ys(0) & "\'and [物料类别] = \'" & dr("物料类别") & "\'and [物料属性] = \'" & dr("物料属性") & "\'") For Each xx As String In xxs Dim dr2 As DataRow = DataTables("产品结构").AddNew() dr2("物料编码") = xx Next Next Next
|
-- 作者:大红袍 -- 发布时间:2016/7/4 22:14:00 -- Dim dr As Row = Tables("数据导入源").current Dim xxs As List(Of String) xxs = DataTables("产品").GetValues("物料编码", "[规格型号] = \'" & dr("规格型号") & "\'") For Each xx As String In xxs For Each ys As String In dr("颜色").split(",") Dim dr2 As DataRow = DataTables("产品结构").AddNew() dr2("物料编码") = xx dr2("颜色") = ys Next Next |