以文本方式查看主题

-  易表在线答疑  (http://egrid2000.com/dvbbs/index.asp)
--  用户社区  (http://egrid2000.com/dvbbs/list.asp?boardid=2)
----  [求助]公式原理  (http://egrid2000.com/dvbbs/dispbbs.asp?boardid=2&id=25632)

--  作者:iyplx2425
--  发布时间:2013/5/27 12:04:00
--  [求助]公式原理

 

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:1122.egd

 

Wjq1072老师:上传文件是您去年帮我做的文件中的一部分,我们一直在用,非常感谢。最近本人在研究公式时,对“XL”表的按钮公式中的主要公式弄不明白。以下公式能不能请您用颜色标注出各个分步的公式,以便本人逐条理解。特别 @是和#的用法。谢谢。

 

 Eval("AppendFor(""下料"",""产品代码,产品名称,零部件图号,零部件名称,单台数量,"+Substitute(Substitute(Substitute(Eval("Substitute(""|@|#|"",""|"","""+Substitute([%XL%],"|",""")+""|""+Substitute(""|@|#|"",""|"",""")+""")"),"@",""",""产品代码,产品名称,零部件图号,零部件名称,单台数量,工价"","""),"#",""", "">"" ,0) And EvalFor(GridName,""工序名称"","""""""),"|",""""""",""工序名称"",""="","""") And AppendFor(""下料"",""产品代码,产品名称,零部件图号,零部件名称,单台数量,")+""""""",""工序名称"",""="","""")")


--  作者:wjq1072
--  发布时间:2013/5/27 14:24:00
--  

AppendFor("下料","产品代码,产品名称,零部件图号,零部件名称,单台数量,数割","产品代码,产品名称,零部件图号,零部件名称,单台数量,工价","数割", ">" ,0) And EvalFor(GridName,"工序名称","""数割""","工序名称","=","") And

AppendFor("下料","产品代码,产品名称,零部件图号,零部件名称,单台数量,大剪","产品代码,产品名称,零部件图号,零部件名称,单台数量,工价","大剪", ">" ,0) And EvalFor(GridName,"工序名称","""大剪""","工序名称","=","") And

AppendFor("下料","产品代码,产品名称,零部件图号,零部件名称,单台数量,小剪","产品代码,产品名称,零部件图号,零部件名称,单台数量,工价","小剪", ">" ,0) And EvalFor(GridName,"工序名称","""小剪""","工序名称","=","") And

AppendFor("下料","产品代码,产品名称,零部件图号,零部件名称,单台数量,仿割","产品代码,产品名称,零部件图号,零部件名称,单台数量,工价","仿割", ">" ,0) And EvalFor(GridName,"工序名称","""仿割""","工序名称","=","") And

AppendFor("下料","产品代码,产品名称,零部件图号,零部件名称,单台数量,直割","产品代码,产品名称,零部件图号,零部件名称,单台数量,工价","直割", ">" ,0) And EvalFor(GridName,"工序名称","""直割""","工序名称","=","") And

AppendFor("下料","产品代码,产品名称,零部件图号,零部件名称,单台数量,型切","产品代码,产品名称,零部件图号,零部件名称,单台数量,工价","型切", ">" ,0) And EvalFor(GridName,"工序名称","""型切""","工序名称","=","") And

AppendFor("下料","产品代码,产品名称,零部件图号,零部件名称,单台数量,锯切","产品代码,产品名称,零部件图号,零部件名称,单台数量,工价","锯切", ">" ,0) And EvalFor(GridName,"工序名称","""锯切""","工序名称","=","") And

AppendFor("下料","产品代码,产品名称,零部件图号,零部件名称,单台数量,剪地边条","产品代码,产品名称,零部件图号,零部件名称,单台数量,工价","剪地边条", ">" ,0) And EvalFor(GridName,"工序名称","""剪地边条""","工序名称","=","") And

AppendFor("下料","产品代码,产品名称,零部件图号,零部件名称,单台数量,校平","产品代码,产品名称,零部件图号,零部件名称,单台数量,工价","校平", ">" ,0) And EvalFor(GridName,"工序名称","""校平""","工序名称","=","") And

AppendFor("下料","产品代码,产品名称,零部件图号,零部件名称,单台数量,坡口","产品代码,产品名称,零部件图号,零部件名称,单台数量,工价","坡口", ">" ,0) And EvalFor(GridName,"工序名称","""坡口""","工序名称","=","") And

AppendFor("下料","产品代码,产品名称,零部件图号,零部件名称,单台数量,组焊","产品代码,产品名称,零部件图号,零部件名称,单台数量,工价","组焊", ">" ,0) And EvalFor(GridName,"工序名称","""组焊""","工序名称","=","") And

AppendFor("下料","产品代码,产品名称,零部件图号,零部件名称,单台数量,折压","产品代码,产品名称,零部件图号,零部件名称,单台数量,工价","折压", ">" ,0) And EvalFor(GridName,"工序名称","""折压""","工序名称","=","")


--  作者:iyplx2425
--  发布时间:2013/5/27 14:52:00
--  
老师这样列出的公式好懂,我想弄明白原始公式中Substitute()函数与|@|#|之间的嵌套关系是怎样建立的。能指教吗?谢谢!
--  作者:iyplx2425
--  发布时间:2013/5/27 15:15:00
--  
我的意思是,老师能不能用不同字体的颜色把原始公式的不同层次标记出来,让我能通过公式的句读来领会公式的含义。
--  作者:iyplx2425
--  发布时间:2013/5/27 15:32:00
--  

例如公式:Number(Mid(Right(FileName,12),2,2))

公式的目的是将一个文件名为“1305日报.egd”中的“05”两个字符转化为数值。最里一个层次是先用Right()函数将文件名“1305日报.egd”提取出来(其中红色的一段),然后用Mid()函数将“1305日报.egd”中第三、第四个字符“05”提取出来(其中绿色的一段),最后用Number()函数将“05”转化为数值(其中黑色的一段)。

这样用不同颜色按公式的层次标识后,就可以按句读来领会比较复杂的公式了。


--  作者:wjq1072
--  发布时间:2013/5/27 15:38:00
--  
http://www.egrid2000.com/dvbbs/dispbbs.asp?boardid=3&Id=159&page=4
--  作者:iyplx2425
--  发布时间:2013/5/27 16:02:00
--  
看来一时半会也领会不了。不过还是谢谢了。
--  作者:wjq1072
--  发布时间:2013/5/27 16:20:00
--  
 

AppendFor("下料","-------,数割","-------","数割", ">" ,0) And EvalFor(GridName,"工序名称","""数割""","工序名称","=","") And

AppendFor("下料","-------,大剪","-------","大剪", ">" ,0) And EvalFor(GridName,"工序名称","""大剪""","工序名称","=","") And

AppendFor("下料","-------,小剪","-------","小剪", ">" ,0) And EvalFor(GridName,"工序名称","""小剪""","工序名称","=","") And

AppendFor("下料","-------,仿割","-------","仿割", ">" ,0) And EvalFor(GridName,"工序名称","""仿割""","工序名称","=","") And

---------

变量%XL%:

"数割|大剪|小剪|仿割|直割|型切|锯切|剪地边条|校平|坡口|组焊|折压"


需要一翻三的通用公式:


一翻三("A|B|C"→"A@A#A|B@B#B|C@C#C")
公式:Eval("Substitute(""|@|#|"",""|"","""+Substitute("A|B|C","|",""")+""|""+Substitute(""|@|#|"",""|"",""")+""")")
结果:A@A#A|B@B#B|C@C#C


--  作者:wjq1072
--  发布时间:2013/5/27 21:02:00
--  

想学习Eval公式,必须理解下面的通用公式:

 

一翻二("A|B|C"→"A@A|B@B|C@C")
公式:Eval("Substitute(""|@|"",""|"","""+Substitute("A|B|C","|",""")+""|""+Substitute(""|@|"",""|"",""")+""")")
结果:A@A|B@B|C@C
 
一翻三("A|B|C"→"A@A#A|B@B#B|C@C#C")
公式:Eval("Substitute(""|@|#|"",""|"","""+Substitute("A|B|C","|",""")+""|""+Substitute(""|@|#|"",""|"",""")+""")")
结果:A@A#A|B@B#B|C@C#C
 
一翻四("A|B|C"→"A@A#A&A|B@B#B&B|C@C#C&C")
公式:Eval("Substitute(""|@|#|&|"",""|"","""+Substitute("A|B|C","|",""")+""|""+Substitute(""|@|#|&|"",""|"",""")+""")")
结果:A@A#A&A|B@B#B&B|C@C#C&C
------------
一翻六--------
公式:Eval("Substitute(""|@|#|$|%|&|"",""|"","""+Substitute("A|B|C|D","|",""")+""|""+Substitute(""|@|#|$|%|&|"",""|"",""")+""")")


--  作者:iyplx2425
--  发布时间:2013/5/28 9:11:00
--  
我把老师发的东西记下了,慢慢领会。谢谢了。