CSV data to select drop down menu?

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.
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
compressor
Posts: 3
Joined: Sun Jan 04, 2009 10:14 pm

CSV data to select drop down menu?

Post by compressor » Mon Jan 05, 2009 3:54 am

Seems like it this should be simple but I am not a programmer.

I am automating a web form for real estate data.
I want to take data from a csv file and depending on the value select the corresponding
drop down menu on the web form.

For instance:
Column 14 of the csv file is the number "3" for number of bedrooms.
The webform has a drop down menu for the number of bedrooms, i.e. 0, 1,2, 3, 4, 5, 6, etc.
I want iMacros to select the corresponding drop down menu number from the data in the cvs file.

How?
User avatar
Tech Support
Posts: 4948
Joined: Tue Sep 20, 2005 7:25 pm
Contact:

Re: CSV data to select drop down menu?

Post by Tech Support » Mon Jan 05, 2009 10:35 pm

I think this sample macro almost does what you need to do: http://wiki.imacros.net/Demo-Loop-Csv-2-Web and does not use scripting.

Here is the same solution with scripting: http://wiki.imacros.net/File-2-Web.vbs
compressor
Posts: 3
Joined: Sun Jan 04, 2009 10:14 pm

Re: CSV data to select drop down menu?

Post by compressor » Wed Jan 07, 2009 2:10 am

I referred to the demo but can't seem to make it work. How are %, $ or * properly used to accomplish my task?

Here is the recorded line of code:

TAG POS=1 TYPE=SELECT FORM=NAME:Form ATTR=ID:dnn_ctr536_BPOForm_ucSoldComp_SoldComp1_ddlBedroomCt CONTENT=4

The pull down is setup like this for number of bedrooms.
CONTENT=1 selects 0 bedrooms
CONTENT=2 selects 1 bedrooms
CONTENT=3 selects 2 bedrooms
CONTENT=4 selects 3 bedrooms

So "CONTENT=4" actually selects the number "3" in the pull down menu.

I need the macro to read the number "3" in COLUMN 19 of the inut CSV and then select the 4th selection in the pull down which is the selection for 3 bedrooms.
Is there away to tell the macro to read the value in Column 19, add 1 to it and then select the pull down?
That would accomplish my task, too.

Please advise.Thank you.
compressor
Posts: 3
Joined: Sun Jan 04, 2009 10:14 pm

Re: CSV data to select drop down menu?

Post by compressor » Fri Jan 09, 2009 4:38 am

Tech Support,

Is there a way to accomplish my task? Please advise.
mknoll1
Posts: 174
Joined: Fri Dec 23, 2005 4:14 pm

Re: CSV data to select drop down menu?

Post by mknoll1 » Fri Jan 09, 2009 8:21 pm

When interacting with a drop down box you can choose your value 2 ways; By position or by value.

When you describe this:

The pull down is setup like this for number of bedrooms.
CONTENT=1 selects 0 bedrooms
CONTENT=2 selects 1 bedrooms
CONTENT=3 selects 2 bedrooms
CONTENT=4 selects 3 bedrooms

You are selecting by position. If instead you wrote:

CONTENT=$*3*

the macro would choose the first position in the box that contained a 3.

In your example what you want is

CONTENT=$*{{!COL19}}*

This is much easier than messing with your actual variables to add one to the value in Column 19. In addition if they remove 0 at some point because they realize no one wants a house without a bathroom your macro should keep working with no changes.

The * is probably not strictly necessary but I have run across enough sites that actually have <SP>3<SP> instead of just 3 that I always use the wildcards.
Gautengusa
Posts: 6
Joined: Sun Dec 30, 2012 4:43 pm

Re: CSV data to select drop down menu?

Post by Gautengusa » Wed Jan 09, 2013 3:19 pm

You are selecting by position. If instead you wrote:

CONTENT=$*3*

the macro would choose the first position in the box that contained a 3.

In your example what you want is

CONTENT=$*{{!COL19}}*

Where is the reference to CONTENT=$*3* ?

For example

TAG POS=1 TYPE=SELECT FORM=NAME:frmImportFormRender ATTR=NAME:ifcContentSubjectPool CONTENT=%Yes
Or
TAG POS=1 TYPE=SELECT FORM=NAME:frmImportFormRender ATTR=NAME:ifcContentCommunityPool CONTENT=%No

My CSV file either has YES or NO
So I want to select the correct entry

I wrote
TAG POS=1 TYPE=SELECT FORM=NAME:frmImportFormRender ATTR=NAME:ifcContentCommunityPool CONTENT=$*{{!COL19}}*

and nothing changes
Post Reply