Change Drop Down Button Using CSV

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.

Moderators: Community Moderators, iMacros Moderators

Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the Google search box (at the top of each forum page) to see if a similar problem or question has already been addressed. This will search the entire contents of the forums as well as the iMacros Wiki.
3. We can respond much faster to your posts if you include the following information:

CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST

Answering your own posts (e.g. attempting to "bump" your topic) drops your topic from the list of unanswered threads, so it may actually receive less views.

Change Drop Down Button Using CSV

by Tamilselvan on Sat Apr 08, 2017 3:34 am

Version 9.0.3
Windows 10
Firefox 50.1.0

Any one help this code, please

VERSION BUILD=9030808 RECORDER=FX
TAB T=1
SET !DATASOURCE "C:\\Users\\OFFICE\\Documents\\iMacros\\Datasources\\JobCard-No.csv"
SET !LOOP 2
SET !DATASOURCE_LINE {{!LOOP}}

'Select Village name
TAG POS=1 TYPE=SELECT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_DDL_Village EXTRACT=TXT

' Extract Length 15. : TAG POS=1 TYPE=SELECT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_DDL_Village CONTENT=%2906015005007<SP><SP><SP><SP><SP>

SET !VAR5 EVAL("'{{!EXTRACT}}'.trim();")

'After trim Extract Length is 13. Because i need to check both in .csv 4th column length is 13.

SET !VAR3 EVAL("if({{!COL4}}!={{!VAR5}}){TAG POS=1 TYPE=SELECT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_DDL_Village CONTENT={{!COL4}}} else{do nothing and move to next row until a match is found};")

I have some error.

missing ; before statement, line: 22 (Error code: -1001)


.CSV File contain
JobCard-No..jpg
Tamilselvan
 
Posts: 47
Joined: Mon Mar 07, 2016 3:49 am

Re: Change Drop Down Button Using CSV

by chivracq on Sat Apr 08, 2017 9:42 am

Tamilselvan wrote:
Code: Select all
Version 9.0.3
Windows 10
Firefox 50.1.0


Any one help this code, please

Code: Select all
VERSION BUILD=9030808 RECORDER=FX
TAB T=1
SET !DATASOURCE "C:\\Users\\OFFICE\\Documents\\iMacros\\Datasources\\JobCard-No.csv"
SET !LOOP 2
SET !DATASOURCE_LINE {{!LOOP}}

'Select Village name
TAG POS=1 TYPE=SELECT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_DDL_Village EXTRACT=TXT

' Extract Length 15. : [b]TAG POS=1 TYPE=SELECT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_DDL_Village CONTENT=%2906015005007<SP><SP><SP><SP><SP>[/b]

SET !VAR5 EVAL("'{{!EXTRACT}}'.trim();")

'After trim Extract Length is 13. Because i need to check both in .csv 4th column length is 13.

SET !VAR3 EVAL("if({{!COL4}}!={{!VAR5}}){TAG POS=1 TYPE=SELECT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_DDL_Village CONTENT={{!COL4}}} else{do nothing and move to next row until a match is found};")


I have some error.
missing ; before statement, line: 22 (Error code: -1001)

.CSV File contain
JobCard-No..jpg

Hum..., I've never tried, but I don't think this Syntax works, and if it worked, it would be stg like:
Code: Select all
SET !VAR3 EVAL("if('{{!COL4}}'!='{{!VAR5}}'){TAG POS=1 TYPE=SELECT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_DDL_Village CONTENT=%'{{!COL4}}';};")


What will work is stg like:
Code: Select all
SET !VAR3 EVAL("var z; if('{{!COL4}}'!='{{!VAR5}}'){z=1;} else{z=0;}; z;")
SET !ERRORIGNORE YES
TAG POS={{!VAR3}} TYPE=SELECT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_DDL_Village CONTENT=%{{!COL4}}

The "Principle" is to spit out a "1" or a "0" with the 'EVAL()' Statement to reuse for the 'TAG' Statement with the "Trick" that 'TAG POS=0' will simply do nothing...

(And you had forgotten the '%' Selector for the DDLB...)
- (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...
chivracq
 
Posts: 6281
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Change Drop Down Button Using CSV

by Tamilselvan on Mon Apr 10, 2017 2:22 am

Thanks a lot.

this Syntax works

SET !VAR3 EVAL("var z; if('{{!COL4}}'!='{{!VAR5}}'){z=1;} else{z=0;}; z;")
SET !ERRORIGNORE YES
TAG POS={{!VAR3}} TYPE=SELECT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_DDL_Village CONTENT=%{{!COL4}}
And you had forgotten the '%' Selector for the DDLB..

Sorry for forgotten the '%' Selector for the DDLB... :(

Once again thank you very much. :D
Tamilselvan
 
Posts: 47
Joined: Mon Mar 07, 2016 3:49 am

Re: Change Drop Down Button Using CSV

by chivracq on Mon Apr 10, 2017 6:06 am

Tamilselvan wrote:Thanks a lot.

this Syntax works

Code: Select all
SET !VAR3 EVAL("var z; if('{{!COL4}}'!='{{!VAR5}}'){z=1;} else{z=0;}; z;")
SET !ERRORIGNORE YES
TAG POS={{!VAR3}} TYPE=SELECT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_DDL_Village CONTENT=%{{!COL4}}

And you had forgotten the '%' Selector for the DDLB..

Sorry for forgotten the '%' Selector for the DDLB... :(

Once again thank you very much. :D

OK, good to hear..., Thanks for the Feedback/Follow-up... :D
- (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...
chivracq
 
Posts: 6281
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)


Return to Data Extraction and Web Screen Scraping

Who is online

Users browsing this forum: No registered users and 3 guests

-->