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.
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.
Here is a macro that must work fine with the first 5 columns of your datasource:
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.
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