I'm looking for a possibility to let a user choose what column of his CSV input the script should use in the {{!COLn}}
part.
我正在寻找让用户选择脚本应该在{{!COLn}}部分中使用的CSV输入列的可能性。
PROMPT "Please enter CSV column:" !VAR1
SET !DATASOURCE C:\User\Desktop\Test\testsource.csv
SET !DATASOURCE_COLUMNS 100
SET !DATASOURCE_LINE {{i}}
URL GOTO=http://www.somewebsite.com
TAG POS=1 TYPE=BUTTON ATTR=TXT:123:<SP>*
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:NoFormName ATTR=* CONTENT={{!COLn}}
TAG POS=1 TYPE=TD ATTR=TXT:{{!COLn}}
n in !COLn
should be set to the user defined variable !VAR1
. I got now clue how! Thanks for all advices.
n in!COLn应设置为用户定义的变量!VAR1。我现在知道如何!谢谢你的所有建议。
2 个解决方案
#1
1
Here is a macro that must work fine with the first 5 columns of your datasource:
这是一个宏,必须与数据源的前5列一起正常工作:
PROMPT "Please enter CSV column:" !VAR1
SET !DATASOURCE C:\User\Desktop\Test\testsource.csv
SET !DATASOURCE_COLUMNS 100
SET !DATASOURCE_LINE {{i}}
SET row "'{{!COL1}}', '{{!COL2}}', '{{!COL3}}', '{{!COL4}}', '{{!COL5}}'"
SET col EVAL("var col = eval('[{{row}}]'); col[{{!VAR1}} - 1];")
URL GOTO=http://www.somewebsite.com
TAG POS=1 TYPE=BUTTON ATTR=TXT:123:<SP>*
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:NoFormName ATTR=* CONTENT={{col}}
TAG POS=1 TYPE=TD ATTR=TXT:{{col}}
You should manually edit the line SET row ...
so that it would represent the whole row, i.e. contain all the '{{!COLn}}'
separated with commas. BTW, if the number of columns is big or/and changing often, I advise to write an additional macro that will generate this string for you.
您应该手动编辑SET行...以便它代表整行,即包含用逗号分隔的所有“{{!COLn}}”。顺便说一句,如果列数很大或者经常变化,我建议写一个额外的宏来为你生成这个字符串。
#2
1
Not a simple answer but you can create a php website (even for free), add a NXM matrix/dataset to it and have a simple url interface www.mysite.com/index.php?loop={{!LOOP}}&col={{!VAR1}} to return the value you want
不是一个简单的答案,但你可以创建一个PHP网站(即使是免费的),添加一个NXM矩阵/数据集,并有一个简单的URL界面www.mysite.com/index.php?loop={{!LOOP}}&col = {{!VAR1}}返回您想要的值
#1
1
Here is a macro that must work fine with the first 5 columns of your datasource:
这是一个宏,必须与数据源的前5列一起正常工作:
PROMPT "Please enter CSV column:" !VAR1
SET !DATASOURCE C:\User\Desktop\Test\testsource.csv
SET !DATASOURCE_COLUMNS 100
SET !DATASOURCE_LINE {{i}}
SET row "'{{!COL1}}', '{{!COL2}}', '{{!COL3}}', '{{!COL4}}', '{{!COL5}}'"
SET col EVAL("var col = eval('[{{row}}]'); col[{{!VAR1}} - 1];")
URL GOTO=http://www.somewebsite.com
TAG POS=1 TYPE=BUTTON ATTR=TXT:123:<SP>*
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:NoFormName ATTR=* CONTENT={{col}}
TAG POS=1 TYPE=TD ATTR=TXT:{{col}}
You should manually edit the line SET row ...
so that it would represent the whole row, i.e. contain all the '{{!COLn}}'
separated with commas. BTW, if the number of columns is big or/and changing often, I advise to write an additional macro that will generate this string for you.
您应该手动编辑SET行...以便它代表整行,即包含用逗号分隔的所有“{{!COLn}}”。顺便说一句,如果列数很大或者经常变化,我建议写一个额外的宏来为你生成这个字符串。
#2
1
Not a simple answer but you can create a php website (even for free), add a NXM matrix/dataset to it and have a simple url interface www.mysite.com/index.php?loop={{!LOOP}}&col={{!VAR1}} to return the value you want
不是一个简单的答案,但你可以创建一个PHP网站(即使是免费的),添加一个NXM矩阵/数据集,并有一个简单的URL界面www.mysite.com/index.php?loop={{!LOOP}}&col = {{!VAR1}}返回您想要的值