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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Load multiple files with some missing some colums

I don' t seem to find the answer to this.

I want to load multiple CSV files, in which the columns are named, but some of them miss some columns

Ex.

file 1 to n have columns (a,b,c,d)

file n+1 to p have columns (a,b,c,d,e)

if my load scripts tries to read column 'e' I get an error for files 1 to n.

How can I prevent this?

Thanks in advance

1 Solution

Accepted Solutions
maxgro
MVP
MVP

set concat='';

for Each file in FileList('*.csv')

  table:

  $(concat)

  load    *,   '$(file)' as filename

  from $(file);

  set concat=' concatenate (table) ';

NEXT;

View solution in original post

12 Replies
sudeepkm
Specialist III
Specialist III

Anonymous
Not applicable
Author

Thank you, I get your idea, but this seems an overkill for my case.

Is there really no way in Qlikview load scripts to do something like this

LOAD

a as [field a],

b as [field b],

c as [field c],

d as [field d],

if (e exists, e, null) as [field d]

...

sudeepkm
Specialist III
Specialist III

I think load * from files can work. try it.

maniram23
Creator II
Creator II

Try this one . Its helpful for you.

let vs='File n+1';

FOR Each vs in 'Fil 1','File n+1';

LOAD *

FROM

(biff, embedded labels, table is $(vs));

NEXT vs;

maxgro
MVP
MVP

set concat='';

for Each file in FileList('*.csv')

  table:

  $(concat)

  load    *,   '$(file)' as filename

  from $(file);

  set concat=' concatenate (table) ';

NEXT;

marcus_sommer

There is no way inside from a load to check if fields are existing or not. The easiest way would be the suggestions below from maxgro‌- use it, it's easy.

- Marcus

qlikviewwizard
Master II
Master II

‌it is not possible .

Anonymous
Not applicable
Author

This is probably it.

marcus_sommer

Have you checked the solution which had maxgro suggested above?