Problem with ONDOWNLOAD - Incorrect file name when page error is found in between array list

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
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
kacharuk
Posts: 1
Joined: Mon Apr 12, 2021 11:46 am

Problem with ONDOWNLOAD - Incorrect file name when page error is found in between array list

Post by kacharuk » Mon Apr 12, 2021 11:57 am

Hi,

I'm trying to pull P&L data from a website by looping company TAX IDs. And save the Excel export using TAX ID as file name as well.
Some of the page will return error (Error 500--Internal Server Error) and I need the script to continue with the next TAX IDs in the Array (using EVAL)
So I put !ERRORIGNORE YES, but while the page URL will continue to loop just fine, the filename is incorrect.
For example, from below code, I have 3 tax IDs:
1. 0845562003531
2. 0833546001268
3. 0105543043901

TAX ID #1: page will load fine, Excel file is named correctly.
TAX ID #2: page will return Error 500. No Excel file created.
TAX ID #3: page will load fine, BUT Excel file is named with TAX ID#2's instead of of #3.

This problem is not observed if all the TAX IDs lead to page that can load successfully.

Perhaps ERRORIGNORE is not the right solution? Any advice please?

Code: Select all

VERSION BUILD=1010 RECORDER=CR

SET !VAR1 EVAL("['0845562003531','0833546001268','0105543043901'][{{!LOOP}} - 1];")

URL GOTO=https://datawarehouse.dbd.go.th/fin/profitloss/5/{{!VAR1}}
WAIT SECONDS=5

SET !ERRORIGNORE YES
ONDOWNLOAD FOLDER=* FILE={{!VAR1}}.xls WAIT=YES

TAG POS=1 TYPE=BUTTON ATTR=ID:XLS
Post Reply