Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
MindaugasBacius
Partner - Specialist III
Partner - Specialist III

Finding error

Hello,

Let's say I have the script like:

SET ErrorMode = 0;

tmp:

Load Type

     ,Number

From [\\FS-03\Data*.xlsx]

;

Set ErrorMode = 1;


Everything reloads well - but in a script log I found a line with an error:

Error: Field not found - <Type>


How should I trace what specific file have just generated this kind of error?

Thank you!

1 Solution

Accepted Solutions
prieper
Master II
Master II

Might be easier to work with FILELIST:

aircode

SET ERRORMODE = 0;

LOAD * FROM $(sFile) ....;

FOR EACH sFile in FILELIST ('\\FS-03\Data*.xlsx')

LOAD * FROM $(sFile) ....;

IF SCRIPTERRORCOUNT() THEN

     TRACE Error incurred in $(sFile);

END IF

NEXT sFile

SET ERRORMODE = 1;


not quite sure, whether the TRACE will work this way. But think the way is clear.


Peter

View solution in original post

6 Replies
Anil_Babu_Samineni

Actually this works as below

If ErrorMode = 1, the script execution stops and it is prompted to user.

If ErrorMode = 0, then script execution simply ignores current statement and follows executing next statements


i am not sure, where you are and what is the use to ErrorMode. Will you explain that? Meanwhile for trace you can try something like below


SET ErrorMode = 0;

tmp:

Load Type

     ,Number

From [\\FS-03\Data*.xlsx];

Set ErrorMode = 1;


Trace Concat($(ErrorMode), Chr(10));

Exit Script;

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
MindaugasBacius
Partner - Specialist III
Partner - Specialist III
Author

I know that the data files I am loading are prompt to errors. To avoid failing the load I just use ErrorMode.

In case I remove ErrorMode it will stop reloading and return me an error of:

Screenshot_1.jpg

That do not provide any useful information.

I just want to know which file fails as I am loading data with a wildcard.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Add

:

FileName() AS FName,

:

to your LOAD statement. Then check what values the field FName contains.

Since your tweaking of ErrorMode will make the LOAD statement skip any erroneous files and proceed to the next, the filenames that are missing from your field FName will either have no rows or missing fields.

Anonymous
Not applicable

Trace Concat($(ErrorMode), Chr(10)) &  '[\\FS-03\Data*.xlsx]';


you could use a variable with the excel file loaded at each point

Anil_Babu_Samineni

Off course, I made one sample for you with out any error in script and Log file too

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
prieper
Master II
Master II

Might be easier to work with FILELIST:

aircode

SET ERRORMODE = 0;

LOAD * FROM $(sFile) ....;

FOR EACH sFile in FILELIST ('\\FS-03\Data*.xlsx')

LOAD * FROM $(sFile) ....;

IF SCRIPTERRORCOUNT() THEN

     TRACE Error incurred in $(sFile);

END IF

NEXT sFile

SET ERRORMODE = 1;


not quite sure, whether the TRACE will work this way. But think the way is clear.


Peter