Skiping a row when reading from csv

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
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
BLiTzKrIeGx1337
Posts: 41
Joined: Sat Nov 16, 2019 10:05 pm

Skiping a row when reading from csv

Post by BLiTzKrIeGx1337 » Tue May 25, 2021 2:56 pm

Windows 10 64b
FF 88.0.1 (64-bit)
iMacros 10101485 PE

I have a large macro that reads from a csv to create new products on the e-commerce site that I manage, the macro stats like this -

Code: Select all

SET !DATASOURCE C:\Users\forms\Desktop\AFDmacroCSVs\AFDUpdateNewTest.csv
SET !LOOP 2
SET !DATASOURCE_LINE {{!LOOP}}
SET !TIMEOUT_STEP 100
URL GOTO=https://heraldpg.myprintdesk.net/DSF/Admin/ManageProducts.aspx?forcedToLoadOldClassic=true
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:aspnetForm ATTR=ID:ctl00_ctl00_C_M_ButtonCreateProduct
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ctl00_C_M_txtName CONTENT={{!COL1}}
WAIT SECONDS=1
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:aspnetForm ATTR=ID:ctl00_ctl00_C_M_btnNext
//the message would show up at this step
If a product already exists it will show a message and won't let me proceed until I change the name, so to keep the macro from stopping I have to check the list of new products, see which ones are just updates, and remove them. What I want to try to do is skip the current loop number if that message is detected on the page, but I'm not sure how to do that and have not had any luck searching for something like that.

This is the CSS Selector for the message that appears - #ctl00_ctl00_C_M__ItemNameMustBeUnique

If anyone knows how or knows a different way to do it that would be fantastic, thanks!
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Skiping a row when reading from csv

Post by chivracq » Tue May 25, 2021 3:17 pm

BLiTzKrIeGx1337 wrote:
Tue May 25, 2021 2:56 pm

Code: Select all

Windows 10 64b
FF 88.0.1 (64-bit)
iMacros 10101485 PE
I have a large macro that reads from a csv to create new products on the e-commerce site that I manage, the macro stats like this -

Code: Select all

SET !DATASOURCE C:\Users\forms\Desktop\AFDmacroCSVs\AFDUpdateNewTest.csv
SET !LOOP 2
SET !DATASOURCE_LINE {{!LOOP}}
SET !TIMEOUT_STEP 100
URL GOTO=https://heraldpg.myprintdesk.net/DSF/Admin/ManageProducts.aspx?forcedToLoadOldClassic=true
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:aspnetForm ATTR=ID:ctl00_ctl00_C_M_ButtonCreateProduct
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ctl00_C_M_txtName CONTENT={{!COL1}}
WAIT SECONDS=1
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:aspnetForm ATTR=ID:ctl00_ctl00_C_M_btnNext
//the message would show up at this step
If a product already exists it will show a message and won't let me proceed until I change the name, so to keep the macro from stopping I have to check the list of new products, see which ones are just updates, and remove them. What I want to try to do is skip the current loop number if that message is detected on the page, but I'm not sure how to do that and have not had any luck searching for something like that.

This is the CSS Selector for the message that appears - #ctl00_ctl00_C_M__ItemNameMustBeUnique

If anyone knows how or knows a different way to do it that would be fantastic, thanks!

Hum..., and "again", your FCI is a bit "confusing", v10.1.0 is a Version for CR (and not even the "last"/"current" one (which is v10.1.1 [May 2021])), the only Version that works on FF88 is v10.0.2 for FF.

But OK, anyway, important part in your FCI is "PE", so you can indeed use a DataSource, and for that part, both v10.0.2 for FF and v10.1.x for CR should "behave" the same way...

>>>

Then, hum..., if I understand your Scenario correctly, well..., the easiest Solution I would think, is that you record once clicking/dismissing that Error Msg, and you always include it in the Script / for each Loop, and it will be clicked away if it appears, with stg like:

Code: Select all

SET !DATASOURCE C:\Users\forms\Desktop\AFDmacroCSVs\AFDUpdateNewTest.csv
SET !LOOP 2
SET !DATASOURCE_LINE {{!LOOP}}
SET !TIMEOUT_STEP 100
URL GOTO=https://heraldpg.myprintdesk.net/DSF/Admin/ManageProducts.aspx?forcedToLoadOldClassic=true
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:aspnetForm ATTR=ID:ctl00_ctl00_C_M_ButtonCreateProduct
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ctl00_C_M_txtName CONTENT={{!COL1}}
WAIT SECONDS=1
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:aspnetForm ATTR=ID:ctl00_ctl00_C_M_btnNext

'//the message would show up at this step
SET !ERRORIGNORE YES
SET !TIMEOUT_STEP 0
TAG POS=1 TYPE=* ATTR=ID:*_ItemNameMustBeUnique
SET !ERRORIGNORE NO
SET !TIMEOUT_STEP 100

'... And proceed with the rest of your Script...
- (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...
BLiTzKrIeGx1337
Posts: 41
Joined: Sat Nov 16, 2019 10:05 pm

Re: Skiping a row when reading from csv

Post by BLiTzKrIeGx1337 » Tue May 25, 2021 3:24 pm

The error message isn't a popup, its just a line of text that appears next to it, so there is nothing clickable. And if it appears then the macro can't proceed with that product, so I would need it to skip the row in the csv. So, if the macro is on loop 25, and the message appears, then I'd just need it to start the macro over at loop 26.
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Skiping a row when reading from csv

Post by chivracq » Tue May 25, 2021 3:37 pm

BLiTzKrIeGx1337 wrote:
Tue May 25, 2021 3:24 pm
The error message isn't a popup, its just a line of text that appears next to it, so there is nothing clickable. And if it appears then the macro can't proceed with that product, so I would need it to skip the row in the csv. So, if the macro is on loop 25, and the message appears, then I'd just need it to start the macro over at loop 26.

Yeah well, then...:

Code: Select all

SET !ERRORIGNORE YES
SET !TIMEOUT_STEP 0
... should take care of that...

'!ERRORIGNORE' =YES would already "do the Job" by itself, but as you use a very high Value for '!TIMEOUT_STEP', you will want to shorten that Setting to "0" or maybe "1", or you'll have to wait for 100 Sec for each next Steps in your Script...

Or if you "really" need 100 Sec for '!TIMEOUT_STEP' for the next Steps, it's possible to make it Conditional:

Code: Select all

'//the message would show up at this step
SET !ERRORIGNORE YES
SET !EXTRACT NULL
TAG POS=1 TYPE=* ATTR=ID:*_ItemNameMustBeUnique EXTRACT=TXT
SET Timeout_Cond EVAL("var s='{{!EXTRACT}}'; var z; if(s!='#EANF#'){z=0;} else{z=100;}; z;")
SET !TIMEOUT_STEP {{Timeout_Cond}}

'... And proceed with the rest of your Script...
- (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...
BLiTzKrIeGx1337
Posts: 41
Joined: Sat Nov 16, 2019 10:05 pm

Re: Skiping a row when reading from csv

Post by BLiTzKrIeGx1337 » Tue May 25, 2021 3:42 pm

That isn't ideal but it will certainly work. I need the high timeout_step because the site is very script heavy, at certain points in the macro the site needs decent amounts of time to load the page.

Thanks!
Post Reply