Page 1 of 1

CSV data to select drop down menu?

Posted: Mon Jan 05, 2009 3:54 am
by compressor
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?

Re: CSV data to select drop down menu?

Posted: Mon Jan 05, 2009 10:35 pm
by Tech Support
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

Re: CSV data to select drop down menu?

Posted: Wed Jan 07, 2009 2:10 am
by compressor
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.

Re: CSV data to select drop down menu?

Posted: Fri Jan 09, 2009 4:38 am
by compressor
Tech Support,

Is there a way to accomplish my task? Please advise.

Re: CSV data to select drop down menu?

Posted: Fri Jan 09, 2009 8:21 pm
by mknoll1
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.

Re: CSV data to select drop down menu?

Posted: Wed Jan 09, 2013 3:19 pm
by Gautengusa
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