Jasta014 wrote:
If the number I extract from a website is equal to the number in Column 1 of excel I would like to grab the name in Column 2 of excel and paste it back into a field on the website. If it does not equal then check next row until there's a match. Is it possible to perform this? I imagine I must have to use EVAL to check for a match but I am unsure how to set up the EVAL statement below.
Code: Select all
TAG POS=26 TYPE=TD ATTR=* EXTRACT=TXT
SET !LOOP 1
SET !DATASOURCE C:\Users\*\Desktop\*.csv
SET !VAR1 EVAL("if({{!COL1}}=={{!EXTRACT}}){{{!COL2}}}else{do nothing};")
TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:txtBorrower CONTENT={{!VAR1}}
Interesting Case, ah-ah...!
Yep, it is possible, well..., everything is possible with iMacros, ah-ah...!
There are several ways of implementing what you want, a bit depending on how many Entries (= Rows) do you have in your DataSource?
1- For, say..., up to 10 Entries, you can handle the whole "Processing" within one Run of your Macro but you will need to "emulate" the Looping through the DataSource to fetch all Entries from '!COL1' as they will be needed for your 'EVAL()' Statement for a "long" 'if else if else if else etc...' or 'case' Statement to return the Row Number to reuse afterwards to go and fetch the corresponding '!COL2' Value.
2- For any Number of Entries in your DataSource you could loop your Macro and handle one Row per Loop until a Match has been found and abort the Looping with 'EVAL()' + MacroError()'. But this Approach is "workable" for about 50 or maybe 100 Max Entries, as looping a Macro 50 or 100 times will take "some time", I would think about 10 sec for 50 Loops approx...
3- The same Approach can be implemented using a '.js' Script but you are on IE and '.js' Scripts are only supported on FF.
4- Approach Nb 4 will work for any Nb of Entries in your DataSource, even if you have a few Thousands, ah-ah...! And the whole Processing will take less than 1 sec, which can be an Argument if Speed is needed in your Case. But it requires a bit of "Preparation" outside iMacros before you can run your Macro, ah-ah...!
It will require that you open your '.CSV' File from Excel or OpenOffice and save the File as an '.HTML' File that you will then open in your Browser either manually or from your Macro in a second Tab and your Macro will switch to it to use it as a "Standard" Web-Page with your Nb extracted from TAB_1 used as Attribute to tag its corresponding Cell in 'COL_1' on TAB_2 and extract the Content of 'COL_2' using "Relative Positioning":
Code: Select all
TAB T=1
TAG POS=26 TYPE=TD ATTR=* EXTRACT=TXT
TAB T=2
'URL GOTO=file:///C:/Users/*/Desktop/Your_DataSource.html
TAG POS=1 TYPE=TD ATTR=TXT:{{!EXTRACT}}
SET !EXTRACT NULL
TAG POS=R1 TYPE=TD ATTR=TXT:* EXTRACT=TXT
TAB T=1
TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:txtBorrower CONTENT={{!EXTRACT}}
... With TAB_2 already opened in this Example..., but you should understand the Principle...
Well, good luck and mention for which Approach you choose, and post your final Script... or if you still get stuck...
- (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...