3 Replies Latest reply: Oct 26, 2017 4:20 AM by Subathra Barathiventhan RSS

    Need help to execute for loop

    Subathra Barathiventhan

      Hi all,

       

      I have two tables

      Table1:

      Sitecode
      3
      4

      Table2:

       

      SitecodeValue
      315
      310
      420
      430

       

      My Desired Output:

      load Table2 where sitecode is 3 and store it in april_3.qvd

      load Table2 where sitecode is 4 and store it in april_4.qvd

       

      Error i am getting:

      in april_3.qvd i get datas where sitecode is 3

      but in april_4.qvd i get both sitecode 3,4(here i need only sitecode 4)

       

      my script is:

       

      SheetName1:

      LOAD

          Sitecode

      FROM [lib://data/test22.xlsx]

      (ooxml, embedded labels, table is Sheet1);

       

       

      for iSheet = 0 to NoOfRows('SheetName1') - 1

                     let vSheetName1 = peek('Sitecode',iSheet, 'SheetName1');

       

      Final:

      LOAD

          Sitecode,

          Name,

          Value

      FROM [lib://data/test.xlsx]

      (ooxml, embedded labels, table is Sheet1) where Sitecode='$(vSheetName1)';

      Store Final into [lib://data/april_$(vSheetName1).qvd] (qvd);

       

      Next iSheet

      drop table SheetName1;