Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have am using loop to load 5 similar files. There is one field called [Critical Care Customers] that is present in only one file and is missing in the rest of the files. If this field is missing in any of the files i need to create this field in the script such as null () as [Critical Care Customers] in rest of the files while loading.
Can anybody please suggest how to go about this?
Thanks this helped. I add scripterror = 11 and then loaded the fields with null() as Critical Care Customers where this field was not present.
Thanks I followed similar approach using loop and using scripterror = 11 and then loading null for the missing field
I think loading a field within a concatenated table as null() makes no sense...
Just force a concatenate and QlikView will add this field as null() automatically!
For anyone who comes across this looking for a solution, this thread helped me think about it and to come up with another option.
I ended up loading an empty table first with all the possible fields, then did my loop with Concatenate Load and with * in place of field names. (In my case the files don't have field names.)
//Create table:
Customers:
Load * Inline [
@1, @3, @4, @5, @6, @7, @8, @9
];
//Concatenate all flat files:
For Each vFile In...
Customers:
Concatenate LOAD *
From vFile (txt, codepage is 28591, no labels, delimiter is '|');
Next vFile