12 Replies Latest reply: Aug 22, 2017 9:21 AM by Felip Drechsler RSS

    QVD Load Stats

    qlik tech

      Hi,

       

      I am using the code below to get the stats, it comes up as syntax error, I am unable to figure out why, your help is much appreciated.

       

      SUB Stats;

      LET vEndTime = Now();

      LET vRecords = NoOfRows('$(vTable)');

      LET vFields = NoOfFields('$(vTable)');

       

      Statistics:

      LOAD * From  Statistics.QVD; //where TableName <> '$(vTable)';

      Join (Statistics)

      LOAD

      DISTINCT

           ‘$(vTable)’ AS TableName, 

           ‘$(vStartTime)’ AS StartTime,

           ‘$(vEndTime)’ AS EndTime,

            '$(vRecords)' AS Records,

             '$(vFields)' as Fields

           RESIDENT Statistics;

           STORE Statistics INTO Statistics.qvd;

           DROP TABLE Statistics;

      End SUB ;

        • Re: QVD Load Stats
          Vishwarath Nagaraju

          What is the error you are getting can you post screen shot of that error?

          • Re: QVD Load Stats
            Anand Chouhan

            It seems correct, remove Termination symbol after Stats and try

             

            SUB Stats

            LET vEndTime = Now();

            LET vRecords = NoOfRows('$(vTable)');

            LET vFields = NoOfFields('$(vTable)');

             

            Statistics:

            LOAD * From  Statistics.QVD; //where TableName <> '$(vTable)';

            Join (Statistics)

            LOAD

            DISTINCT

                 ‘$(vTable)’ AS TableName,

                 ‘$(vStartTime)’ AS StartTime,

                 ‘$(vEndTime)’ AS EndTime,

                  '$(vRecords)' AS Records,

                   '$(vFields)' as Fields

                 RESIDENT Statistics;

                 STORE Statistics INTO Statistics.qvd;

                 DROP TABLE Statistics;

            End SUB ;

            • Re: QVD Load Stats
              Felip Drechsler

              Hi,

               

              Your quotation marks are strange

               

              the first 3 lines

              ‘$(vTable)’ AS TableName,

                   ‘$(vStartTime)’ AS StartTime,

                   ‘$(vEndTime)’ AS EndTime,

               

              Have different quotation marks as to

              '$(vRecords)' AS Records,

                     '$(vFields)' as Fields

               

              Try replacing the second load with this:

              LOAD

              DISTINCT

                   '$(vTable)' AS TableName,

                   '$(vStartTime)' AS StartTime,

                   '$(vEndTime)' AS EndTime,

                   '$(vRecords)' AS Records,

                   '$(vFields)' as Fields

              RESIDENT Statistics;

               

              Felipe

              • Re: QVD Load Stats
                Anand Chouhan

                See the attached sample subroutine you can apply this way in your table

                 


                Fact:
                Load * Inline [
                KeyNames
                A_Key
                B_Key
                C_Key
                ]
                ;

                LET vTable = 'Fact';

                SUB Stats
                LET vEndTime = Now();
                LET vRecords = NoOfRows('$(vTable)');
                LET vFields = NoOfFields('$(vTable)');

                Statistics:
                Load * Inline
                [
                ColumnA
                ‘$(vEndTime)’
                '$(vRecords)'
                '$(vFields)'
                ]
                ;

                STORE Statistics INTO Statistics.qvd;
                //DROP TABLE Statistics;
                   
                End SUB;

                //Calling Subroutine Here
                CALL Stats

                • Re: QVD Load Stats
                  qlik tech

                  Additional column.PNG

                   

                  After I load the data, I get an additional column (column 1) which is not part of the table structure, how is it inserted and how can I delete it?