Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Manage Missing Fields In QV Script

Hi,

I am developing an application in QV, where I am loading 20 files, with more than 15 fields in each file. To avoid writing code for each single file, I am using for loop as most of the fields are same in every file.

For i=1 to 20

let x="File_" & i & ".xls"

Load Field1,

        Field2,

        Field3

From $(x);

But my problem is every month its possible that some fields may miss from 1 or 2 files. Like below:

File_1

Field1

Field2

Field3

Field4

File_2

Field1

Field2

Field3

So if I use the same code:

Load Field1,

        Field2,

        Field3,

        Field4

From $(x);

this will work for file_1 but in case of file_2, its showing error field not found. Is there any way where I can Load field1,field2,field3 for table2 by leaving field4, even if its missing.

I tried using set errormode=0; but it skipped the table 2 entirely, But I want to load the 2nd table without the missing field. Please help.

3 Replies

Re: Manage Missing Fields In QV Script

HI,

     Try like this,

    

               For i=1 to 20

                    let x="File_" & i & ".xls"

                        Load * From $(x);

               next

Hope it helps

nagaiank
Valued Contributor III

Re: Manage Missing Fields In QV Script

You may try the following:

File:

load * inline [

DummyField

];

For i=1 to 20

          let x="File_" & i & ".xls"

          Concatenate (File)  Load * From $(x);

  next

drop field DummyField from File;

Not applicable

Re: Manage Missing Fields In QV Script

Thank You.

I cant use load * as tables contain some other fields which I dont want to import. I would like to import some of the selected fields only