Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

dandaanilreddy
Contributor II

Row count of field values

Hello Qlik Developers,

I have a script which generates the total row count of each table in the app. I have created the script in each app and whenever the app refresh a qvd will be generated in a folder which contains all the information about the app name,tables names and row count. Now i have a new requirement ,i have a field called cycleid in which i have values like 1,2,3,.... All the tables will contain the cycleid field. I want to get the row count from all the tables for each value in the cycleid field. I have a loop in my script which loops the tables and gets the row count. I am not sure how to loop each value of the field and get the row count. Can someone help me please?

Thanks,

Anil

2 Replies

Re: Row count of field values

Are you able to share a sample of what you have? or some raw data and the expected output?

dandaanilreddy
Contributor II

Re: Row count of field values

Hi Sunny,

Please see the below script.

trace ;

trace ----> MONITORING;

trace ----> writing log into lib://path\$(vDoc)_$(vTimestamp).qvd;

if(NoOfTables()>0) then

  Let vCategory ='ABC';

  let v_Timestamp = timestamp(now(1));

  set v_TimestampFINAL = $(v_Timestamp);

  For i = 0 to NoOfTables()-1

    LET vTableName = TableName($(i));

    TableStats:

    LOAD as Log_Type

     

   NoOfRows('$(vTableName)') as Log_RowCount

       ,NoOfFields('$(vTableName)') as Log_ColumnCount

    AUTOGENERATE 1

    ; 

  Next

  let vDoc = DocumentTitle();

  let vTimestamp = timestamp(now(1),'YYYYDDMM_hhmmss');

  STORE TableStats INTO [lib://path\$(vDoc)_$(vTimestamp).qvd] (qvd);

//  drop table TableStats;

   

end if

Community Browser