Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

how to identify if a field is present in the load statement?

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?

13 Replies
Anonymous
Not applicable
Author

Thanks this helped. I add scripterror = 11 and then loaded the fields with null() as Critical Care Customers where this field was not present.

Anonymous
Not applicable
Author

Thanks I followed similar approach using loop and using scripterror = 11 and then loading null for the missing field

Anonymous
Not applicable
Author

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!

Lauri
Specialist
Specialist

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