Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
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
MayilVahanan

HI,

     Try like this,

    

               For i=1 to 20

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

                        Load * From $(x);

               next

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
nagaiank
Specialist III
Specialist III

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
Author

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