以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]Substring问题  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=130623)

--  作者:hahahehe21
--  发布时间:2019/1/27 16:39:00
--  [求助]Substring问题
Dim jb As New SQLJoinTableBuilder("白卡纸用量查询表","PNumPaperInfo")
jb.C
jb.AddTable("PNumPaperInfo","PaperID","mstock","MaterialID")
jb.AddTable("PNumPaperInfo","PNum","PNumSumInfo","PNum")
jb.AddExp("克重", "SubString({PNumPaperInfo}.PaperName,1,4)")
jb.AddExp("规格", "SubString({PNumPaperInfo}.PaperName.")   
jb.AddCols("{PNumSumInfo}.InDate","{PNumSumInfo}.PNum","{PNumSumInfo}.Customer","{PNumPaperInfo}.Product","{PNumPaperInfo}.PartsName","{mstock}.Band","{PNumPaperInfo}.PaperName","{PNumPaperInfo}.Scale","{PNumPaperInfo}.CalUnit","{PNumPaperInfo}.SrcCount","{mstock}.SumCount","{mstock}.MSubType","{PNumPaperInfo}.ID")
jb.Filter = "{PNumSumInfo}.InDate >= \'1/1/2018\' AND {PNumSumInfo}.InDate <= \'12/31/2019\' and {mstock}.MSubType = \'白卡纸\'and {mstock}.Band <> \'海龙\'" 
jb.Order = "{PNumPaperInfo}.ID DESC"
jb.Distinct = True
jb.Build()
MainTable = Tables("白卡纸用量查询表")

PaperName的值如“250克博汇丹顶鹤白卡卷筒787mm”、“260克北极豹白卡卷筒787mm
想获取后面5个字符“787mm”作为列“规格”
如何修改代码?

[此贴子已经被作者于2019/1/27 16:41:12编辑过]

--  作者:有点甜
--  发布时间:2019/1/27 17:19:00
--  

比如果

 

jb.AddExp("规格", "right({PNumPaperInfo}.PaperName, 5)")