Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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
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