Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear all,
I want a list of all error files. Suppose in the script I have four load statement. In the First statement I have all the field name and the file. In the second load statement I have a field missing. In third and fourth load statement I have the file missing. I want to see all the errors.
I have used errormode=0; So that reload wont fail. But I want list of all errors. scripterrodetail shows only the last error in detail not the entire error.
Attaching my script and excel. Plz help
This is tested and works with your attachements:
set ErrorMode=0;
ABC:
LOAD ID,
Name,
Age
FROM
ABC.xlsx
(ooxml, embedded labels, table is Sheet1);
ERRORLIST: LOAD 1 AS LoadNo, '$(ScriptErrorDetails)' AS ErrorDetail AUTOGENERATE 1;
LOAD ID,
Name,
Age
FROM
PQR.xlsx
(ooxml, embedded labels, table is Sheet1);
ERRORLIST: LOAD 2 AS LoadNo, '$(ScriptErrorDetails)' AS ErrorDetail AUTOGENERATE 1;
LOAD ID,
Name,
Age
FROM
xyz.xlsx
(ooxml, embedded labels, table is Sheet1);
ERRORLIST: LOAD 3 AS LoadNo, '$(ScriptErrorDetails)' AS ErrorDetail AUTOGENERATE 1;
LOAD ID,
Name,
Age
FROM
rsk.xlsx
(ooxml, embedded labels, table is Sheet1);
ERRORLIST: LOAD 4 AS LoadNo, '$(ScriptErrorDetails)' AS ErrorDetail AUTOGENERATE 1;
You will end up with a table named ERRORLIST that contains four rows and ScriptErrorDetails for each load statement...
You have the special variable ScriptErrorList which is actually a list of all errors... isn't that sufficient for you needs?
If not you can always use an:
ErrorList: LOAD $(ScriptErrorDetail) AUTOGENERATE 1;
After each load to get a single table containing all ScriptErrorDetails for the entire load script. Possibly storing the results at the end of the load script into a QVD for later reference...
Hi Peter, Thanks for your reply. The Error detail will give u only the detail error of the last error not the entire list as I shown in my application above.
Can you please help with an demo application where I can see multiple errors with their filename?
That is the purpose of using the LOAD .... AUTOGENERATE 1 after each load as it will by auto concatenation add multiple rows of ErrorDetails into this table called ErrorList. Give it a try...
This is tested and works with your attachements:
set ErrorMode=0;
ABC:
LOAD ID,
Name,
Age
FROM
ABC.xlsx
(ooxml, embedded labels, table is Sheet1);
ERRORLIST: LOAD 1 AS LoadNo, '$(ScriptErrorDetails)' AS ErrorDetail AUTOGENERATE 1;
LOAD ID,
Name,
Age
FROM
PQR.xlsx
(ooxml, embedded labels, table is Sheet1);
ERRORLIST: LOAD 2 AS LoadNo, '$(ScriptErrorDetails)' AS ErrorDetail AUTOGENERATE 1;
LOAD ID,
Name,
Age
FROM
xyz.xlsx
(ooxml, embedded labels, table is Sheet1);
ERRORLIST: LOAD 3 AS LoadNo, '$(ScriptErrorDetails)' AS ErrorDetail AUTOGENERATE 1;
LOAD ID,
Name,
Age
FROM
rsk.xlsx
(ooxml, embedded labels, table is Sheet1);
ERRORLIST: LOAD 4 AS LoadNo, '$(ScriptErrorDetails)' AS ErrorDetail AUTOGENERATE 1;
You will end up with a table named ERRORLIST that contains four rows and ScriptErrorDetails for each load statement...
That was great Peter extremely thankful of you.
My pleasure.