2 Replies Latest reply: Jan 26, 2017 6:46 AM by Ali Hijazi RSS

    help in script syntax

    Ali Hijazi

      Hello

      I'm working on Qlik Sense project

      I'm reading the names of the tables and looping through them to read and store data as qvd

      my script is as follows and it works correctly in QlikView:

      temp_tables:

          load *;

          sql select

         table_name as name

              from information_schema.tables

              where table_schema = 'lmms'

      and lower(table_name) in
      (
                     'community'

                          ,'person'

                          ,'member'

                          ,'marital_status'

                          ,'household'

                          ,'household_condition'

                          ,'gov_id'

                          ,'gov_id_type'

                          ,'member_vulnerability'

      ,'member_vulnerability_assoc'

                          ,'distribution'

                          ,'location'

                          ,'project'

                          ,'fdp'

                          ,'item'

                          ,'project_type'

                          ,'member_status'

                      );

      /*************************************************************************************/

       

       

          /*

         now read data and store each table as QVD file

          */

      for i=0 to NoOfRows('temp_tables')-1
      let vTableName = Peek('name',$(i),'temp_tables');
      if left('$(vTableName)',1) = '@' then
      let vTableName = '"' & '$(vTableName)' & '"';
      endif
      let vQlikTableName = replace(Replace('$(vTableName)','"',''),'@','');
      $(vQlikTableName):
      load *;
      sql select * from $(vTableName);
      store $(vQlikTableName) into lib://QVDS/$(vQlikTableName).qvd;
      drop table $(vQlikTableName);
      next

       

       

      tables are stored as such

      Untitled.png

      how to evaluate vQlikTableName?

      Please advise