Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
marcus_sommer

How and in which order executed QV a load-statement?

Hello,

how and in which order executed QV a load-statement?

Background is to check within a load-statement if a certain field exists and if not load a dummy-value or another field. But a check like:

Load

....

if(year < 2014, 'n.n.', [Field X]) as [Field X],

....

From path/file*.txt

within a load returned a load-error (field not found) if [Field X] don't exists. This don't failed only by internal field-checks but also by file-functions like:

if(makedate(mid(filebasename(), 11, 4), mid(filebasename(), 16, 2), 1) < '01.01.2014', 'n.n.', [Field X]) as [Field X],

Is there any possibility to solve this within a load-statement and avoiding several loads or loops around the load to create a variable load-statement?

Many thanks, Marcus.

2 Replies
tresesco
MVP
MVP

Could setting ErrorMode be an option ? Like:

Set ErrorMode=0;

Load AA from <>;

If ScriptError=11 then           // 11 - Field not found

     Load

          BB as XField

     From <>;

Else

     Load

          AA as XField

     From <>;

End If

marcus_sommer
Author

Thanks for your reply tresesco. It's an interesting idea but it avoid only the script-error and don't load all my files. I have it also tested with resident and preceding load but it's all the same.

Interesting would be how the load worked from a technical point of view - perhaps Henric Cronström could give some information?

- Marcus