Setting a Variable Column Number to use with a DataSource

Discussions and Tech Support related to the iMacros Firefox Add-on, including the built-in Javascript scripting interface for playing .js files.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information:CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
Cybes
Posts: 31
Joined: Tue Oct 06, 2009 12:06 am

Setting a Variable Column Number to use with a DataSource

Post by Cybes » Mon Sep 22, 2014 1:52 pm

Hi

I was wondering if anyone knows whether it is possible to define a column number as a variable instead?

e.g. Something that might look like.. {{!COL{{!VAR1}}}}

This would allow me to dynamically target a specific cell within a CSV.

Or does anyone know a work around that would achieve a similar affect?

I know you can define a row number as a variable via the DATASOURCE_LINE command (e.g. SET !DATASOURCE {{!VAR1}}).

I am attempting to have different CSV files cross-reference each other to make my scripts as easily maintainable and as easy to follow as possible. So i'm already using different CSV files to cross-reference row numbers in other CSVs, but the limit there is rows, not columns.

Any assistance here would be welcome!
Last edited by Cybes on Sat Feb 24, 2018 1:27 am, edited 1 time in total.
natesreich
Posts: 8
Joined: Wed Oct 29, 2014 3:30 am

Re: Setting a Variable Column Number to use with a Data Sour

Post by natesreich » Wed Oct 29, 2014 3:33 am

I am looking for the same thing. Were you able to find a solution?
Cybes
Posts: 31
Joined: Tue Oct 06, 2009 12:06 am

Re: Setting a Variable Column Number to use with a Data Sour

Post by Cybes » Wed Oct 29, 2014 10:15 am

Unfortunately not, not without resorting to going via JavaScript anyhow and that would take away the ability to control looping as easily / iterations as easily too as it could be no longer be specified via the iMacros interface. I've added it as a suggestion in the Feature requests thread but I don't know if it got the attention of any of the developers/product owners at Ipswitch.
chivracq
Posts: 8535
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Setting a Variable Column Number to use with a DataSourc

Post by chivracq » Sat Feb 24, 2018 1:08 am

Cybes wrote:Hi

I was wondering if anyone knows whether it is possible to define a column number as a variable instead?

e.g. Something that might look like.. {{!COL{{!VAR1}}}}

This would allow me to dynamically target a specific cell within a CSV.

Or does anyone know a work around that would achieve a similar affect?

I know you can define a row number as a variable via the DATASOURCE_LINE command (e.g. SET !DATASOURCE {{!VAR1}}).

I am attempting to have different CSV files cross-reference each other to make my scripts as easily maintainable and as easy to follow as possible. So i'm already using different CSV files to cross-reference row numbers in other CSVs, but the limit there is rows, not columns.

Any assistance here would be welcome!
natesreich wrote:I am looking for the same thing. Were you able to find a solution?
Cybes wrote:Unfortunately not, not without resorting to going via JavaScript anyhow and that would take away the ability to control looping as easily / iterations as easily too as it could be no longer be specified via the iMacros interface. I've added it as a suggestion in the Feature requests thread but I don't know if it got the attention of any of the developers/product owners at Ipswitch.
Hi @Cybes, just checking your older Threads after you just posted in this Thread, and concerning this "old" current Thread, ah-ah...!, I have as well the same EnhReq about "{{!COL{{!LOOP}}}}" in the following Thread (Item '-14-') where I maintain a List of EnhReq's... :wink:
(You can always review "my" List and "express" your Support if you see some other EnhReq('s) you like as well... :idea: )

>

Concerning the OP, one Solution using a '.js' Script has been posted several times on the Forum, about simply concatenating "!COL" + "n" as a String to get "!COLn".

But there is as well another Solution that works in pure '.iim' (only for FF) and that consists of changing/setting '!DATASOURCE_DELIMITER' to some "fake" Character (not being used in your '.CSV'...!) like for example "#" prior to retrieving '{{!COL1}}' (which will then contain your whole Row and not only your original Cell_1), and a simple 'EVAL()' + 'split('#')' allows you to use '!LOOP' (corrected by "-1" as 'split()' starts at Index=i=0) (or any Var you want actually) to select the Col you want by using the Index on the Array returned by the 'split()'... 8)
Simple, ah-ah...!? 8)
And it only works in FF because '!DATASOURCE_DELIMITER' is only supported in iMacros for FF... But hum, 10 sec "Brainstorming" with myself and I already find 1-2-3 way(s) to use more or less the same Technique without the Need for '!D_D' and that would work for all Browsers..., so once you got the Idea, it's easy to find similar Solutions... :wink:
EDIT: Oh...!, and one more...!
(Hum, plus another one as well, I'm starting to lose the count, ah-ah...! But hum, this one is "a good one" ah-ah...! => "Excel => HTML => TR/TD + R-POS" as a Reminder for myself, I'm not sure I will find it back "spontaneously" within 10 sec otherwise, oops..!)

>

Hum, and mini-Rmk, you could edit your Thread Title to put your "Data Source" (2 words) into one single Word, in the iMacros Terminology, 731 Views for the Thread after 3.5 years is not a lot, I guess it would get found by Users searching the Forum more easily with "DataSource" in one Word... :idea:
Last edited by chivracq on Sun Mar 25, 2018 8:05 pm, edited 1 time in total.
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
techimac
Posts: 293
Joined: Fri Feb 20, 2015 9:27 pm

Re: Setting a Variable Column Number to use with a DataSourc

Post by techimac » Sun Mar 25, 2018 4:29 am

anyone has the solution?
Post Reply