以文本方式查看主题

-  易表在线答疑  (http://egrid2000.com/dvbbs/index.asp)
--  用户社区  (http://egrid2000.com/dvbbs/list.asp?boardid=2)
----  强烈建议恢复eval 六步曲的原帖子呀。  (http://egrid2000.com/dvbbs/dispbbs.asp?boardid=2&id=21400)

--  作者:Egei
--  发布时间:2012/6/16 10:37:00
--  强烈建议恢复eval 六步曲的原帖子呀。

Eval可能是易表的精髓函数。看了很多都看不懂,记得当时看六部曲的帖子一下就看懂了。

但现在找不到了。

哪位大侠能恢复一下。


--  作者:金银花
--  发布时间:2012/6/17 7:00:00
--  
 

Eval公式六步曲

左拼部分 + 用Substitute把分隔符替换部分(中间) + 右凑部分


1、       写出列表集(此较为关键):

[%JC%]=ListFor("客户档案","简称",1)


[%JC%]→一翻二

Eval("Substitute(""|@|"",""|"","""+Substitute([%JC%],"|",""")+""|""+Substitute(""|@|"",""|"",""")+""")")


2写出最简单的循环命令。

  ReplaceFor(Grid,"简称","A","进货单位","Instr","A") And ReplaceFor(Grid,"简称","B","进货单位","Instr","B")


3把第2的命令粘贴到记事本中:

编辑→查找替换→在查找框输入:『"』→在在查找框输入:『""』→全部替换,得到 (此时列表为:A@A|B@B)

ReplaceFor(Grid,""简称"",""A"",""进货单位"",""Instr"",""A

(左拼部分)        (A)  (A@A及B@B間的“@”)    (A)

"") And ReplaceFor(Grid,""简称"",""B"",""进货单位"",""Instr"",""B"")

右凑部分

(A|B間的“|”)        (B






4用Substitute把第1的列表集中的分隔符“@”和“|”分別替换为 第3点字符集中的红色部分『"",""进货单位"",""Instr"",""』,和粉紅色部分『"") And ReplaceFor(Grid,""简称"",""』,

得到中间部分:

  Substitute(Substitute(Eval("Substitute(""|@|"",""|"","""+Substitute([%JC%],"|",""")+""|""+Substitute(""|@|"",""|"",""")+""")")

,"@"," "",""进货单位"",""Instr"","""),"|",""") And ReplaceFor(Grid,""简称"",""")


5加上『左拼部分』(第3中列表第一个字符前面所有字符)和『右凑部分』(第3中列表最后字符后面所有字符)

" ReplaceFor(Grid,""简称"","""+Substitute(Substitute(Eval("Substitute(""|@|"",""|"","""+Substitute([%JC%],"|",""")+""|""+Substitute(""|@|"",""|"",""")+""")")

,"@"," "",""进货单位"",""Instr"","""),"|",""") And ReplaceFor(Grid,""简称"",""")

+""")"


6最后用Eval执行它,OK!


Eval(" ReplaceFor(Grid,""简称"","""+Substitute(Substitute(Eval("Substitute(""|@|"",""|"","""+Substitute([%JC%],"|",""")+""|""+Substitute(""|@|"",""|"",""")+""")")

,"@"," "",""进货单位"",""Instr"","""),"|",""") And ReplaceFor(Grid,""简称"",""")

+""")")



--  作者:wjq1072
--  发布时间:2012/6/17 12:15:00
--  

原贴不知道还能不能恢复?!再发一个参考!

 

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

[此贴子已经被作者于2012-6-17 19:24:32编辑过]