Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join us for a live Q&A! September 21, 10 AM ET - Onboarding Fast in Qlik Sense SaaS! REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
olivierbuchy
Creator
Creator

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

olivierbuchy
Creator
Creator
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;

View solution in original post

marcus_sommer
MVP & Luminary
MVP & Luminary

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 .

olivierbuchy
Creator
Creator
Author

This is probably it.

marcus_sommer
MVP & Luminary
MVP & Luminary

Have you checked the solution which had maxgro suggested above?