2 Replies Latest reply: Nov 6, 2016 11:40 PM by Rendi Yanuar RSS

    [ASK] Error multiple concatenate to table inside loop

    Rendi Yanuar

      Dear Qlik Master,

       

      i have a load script that use loop and works fine, sample like below :

      Original Load Script

      Marketing_Budget:

      LOAD * INLINE [

          INITIAL

          1

      ];

       

      FOR nrow = 0 TO noOfRows('MS_Connection') - 1

          LET vDB = peek('ODBC',$(nrow),'MS_Connection');

          Let vFlag = peek('PATH_LEGAL',$(nrow),'MS_Connection');

        $(vDB);

       

      Concatenate(Marketing_Budget)

      SQL select DISTINCT

      substring(PROJECTNO FROM 4 FOR 2) AS Code_Branch,

      '$(vFlag)' AS Kode_Legal,

      ASD.*

      from Marketing ASD

      ;

       

      next;

       

       

      But when i try to add more script to concatenate to another table, error show up, and the query is like below :

      New Load Script

      Marketing_Budget:

      LOAD * INLINE [

          INITIAL

          1

      ];

       

       

      ErrorLog_Tbl:

      LOAD * INLINE [

          INITIAL_ELT

          1

      ];

       

       

      FOR nrow = 0 TO noOfRows('MS_Connection') - 1

          LET vDB = peek('ODBC',$(nrow),'MS_Connection');

          Let vFlag = peek('PATH_LEGAL',$(nrow),'MS_Connection');

        $(vDB);

       

       

      Concatenate(Marketing_Budget)

      SQL select DISTINCT

      substring(PROJECTNO FROM 4 FOR 2) AS Code_Branch,

      '$(vFlag)' AS Kode_Legal,

      ASD.*

      from Marketing ASD

      ;

       

       

      Concatenate(ErrorLog_Tbl)

      LOAD * INLINE[

      LEGAL

      '$(vFlag)'

      ];

       

       

      next;

       

      And the error is :

      Error New Load Script

      Syntax error, missing/misplaced FROM:

       

      Concatenate(ErrorLog_Tbl)

      LOAD * INLINE[

      LEGAL

      'DTABB0'

      ]

      Concatenate(ErrorLog_Tbl)

      LOAD * INLINE[

      LEGAL

      'DTABB0'

      ]

       

       

      I've tried to add set ErrorMode=0;

      Also i've tried to test with static value for my second concatenate, remove single quote for my second concatenate.

      But still, mw second concatenate script doesn't add up.

       

      Why is this happening?

      And is there any solution for this issue?

       

      Many thank you,

      Best Regards