Change Drop Down Button Using CSV

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

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
Tamilselvan
Posts: 129
Joined: Mon Mar 07, 2016 10:49 am

Change Drop Down Button Using CSV

Post by Tamilselvan » Sat Apr 08, 2017 10: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
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Change Drop Down Button Using CSV

Post by chivracq » Sat Apr 08, 2017 4:42 pm

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)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
Tamilselvan
Posts: 129
Joined: Mon Mar 07, 2016 10:49 am

Re: Change Drop Down Button Using CSV

Post by Tamilselvan » Mon Apr 10, 2017 9: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
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Change Drop Down Button Using CSV

Post by chivracq » Mon Apr 10, 2017 1:06 pm

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)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
Post Reply