3 Replies Latest reply: Jul 24, 2012 2:28 PM by Anurag Pattanayak RSS

    Manage Missing Fields In QV Script

    Anurag Pattanayak

      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.