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