Choosing multiple csv as datasource and looping

Discussions and Tech Support specific to the iMacros Firefox add-on.
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
batiatus
Posts: 1
Joined: Fri Jul 26, 2013 11:13 pm

Choosing multiple csv as datasource and looping

Post by batiatus » Fri Jul 26, 2013 11:20 pm

Hey guys. I'm very new at coding macros, I tried to create a macro but I just couldn't handle it.
Here's the thing: Since I know we can fetch data from csv files column by column, can't we use different looping methods for each column?
What I'm trying to do is;

column#1
website1
website2
website3
website4

column#2
red
blue
purple
black
white

First column, {{!COL1}} must be fetched in order, exactly same with my writting order but {{!COL2}} must be looped at the same time.
Is there any code for that? I'd love to see an example. PS: No javascript. I have no idea about it :wink: Thank you very much and sorry for my bad English! :D
User avatar
garyst1981
Posts: 125
Joined: Tue Jan 15, 2013 1:01 am
Location: Philadelphia, PA
Contact:

Re: Choosing multiple csv as datasource and looping

Post by garyst1981 » Mon Jul 29, 2013 1:22 pm

what do you mean with "{{!COL2}} must be looped at the same time."

iMacros loops all columns of a CSV doc at the same time so, using your example:

column#1 column#2
website1 red
website2 blue
website3 purple
website4 black

If you use

Code: Select all

SET !DATASOURCE file.csv
SET !LOOP 2
SET !DATASOURCE_LINE {{!LOOP}}
TAG POS=1 TYPE=XXX ATTR=XXX:XXXX CONTENT={{!COL1}}
TAG POS=1 TYPE=XXX ATTR=XXX:XXXX CONTENT={{!COL2}}
On the first loop it will add the website 1 to the firt field and the word red to the second
for the next loop it will use website2 and blue for filling them, etc
www.gustavorivera.com.mx
josephconlin
Posts: 190
Joined: Wed Aug 06, 2008 2:38 am

Re: Choosing multiple csv as datasource and looping

Post by josephconlin » Wed Jul 31, 2013 7:41 pm

batiatus wrote:Hey guys. I'm very new at coding macros, I tried to create a macro but I just couldn't handle it.
Here's the thing: Since I know we can fetch data from csv files column by column, can't we use different looping methods for each column?
What I'm trying to do is;

column#1
website1
website2
website3
website4

column#2
red
blue
purple
black
white

First column, {{!COL1}} must be fetched in order, exactly same with my writting order but {{!COL2}} must be looped at the same time.
Is there any code for that? I'd love to see an example. PS: No javascript. I have no idea about it :wink: Thank you very much and sorry for my bad English! :D
It might be easier to change your csv file. Right now, it sounds like your csv file looks like this:

Code: Select all

Column1     Column2
website1     red
website2     blue
website3     purple
website4     black
             white
If I'm understanding your question correctly and you want to have every color associated with every website, would changing your csv file like this make it work for you?

Code: Select all

Column1     Column2
website1     red
website1     blue
website1     purple
website1     black
website1     white
website2     red
website2     blue
website2     purple
website2     black
website2     white
...
Post Reply