Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Count of records

Hi,

I'm trying to list the name of table and number of records from qvds.

And I got it right for one qvd but unable to do it when I have multiple qvds.

Can someone suggest me a logic or sample code for this.

Note: There may be multiple qvds and all of them in different locations.

Regards,

Sachin

1 Solution

Accepted Solutions
sunny_talwar

Something like this using the help section as Stefan pointed out:

SUB DoDir(Root)

  For Each File in FileList(Root & '\*.qvd')

  Let vQVDName = QvdTableName('$(File)');

  Let vNumRows = QvdNoOfRecords('$(File)');

  [Rec Count]:

  LOAD *,

    RowNo() as Key;

  LOAD * INLINE [

      QVD Table Name, No Of Records

      $(vQVDName), $(vNumRows)

  ];

  NEXT File

  FOR Each Dir in DirList(Root&'\*')

  Call DoDir(Dir)

  NEXT Dir

END SUB

CALL DoDir ('C:\Users\sunny.a.talwar\Downloads\Test')

View solution in original post

13 Replies
Anonymous
Not applicable
Author

Taking what you did in the script, this should work. Change Cars.qvd and Emp.qvd to the file path

Let vQVDName = QvdTableName  ('Cars.qvd');

Let vNumRows = QvdNoOfRecords('Cars.qvd');

Let vQVDName2 = QvdTableName  ('Emp.qvd');

Let vNumRows2 = QvdNoOfRecords('Emp.qvd');

[Rec Count]:

LOAD * INLINE [

    QVD Table Name, No Of Records

    $(vQVDName), $(vNumRows)

    $(vQVDName2), $(vNumRows2)

  

];

petter
Partner - Champion III
Partner - Champion III

This is a simple and straightforward way (Quick and Dirty) of doing it:

Let vQVDName1 = QvdTableName  ('Cars.qvd');

Let vNumRows1 = QvdNoOfRecords('Cars.qvd');

Let vQVDName2 = QvdTableName  ('Emp.qvd');

Let vNumRows2 = QvdNoOfRecords('Emp.qvd');

[Rec Count]:

LOAD * INLINE [

    QVD Table Name, No Of Records

    $(vQVDName1), $(vNumRows1)

    $(vQVDName2), $(vNumRows2)

];

Not applicable
Author

Thanks Petter, but is there a way to automate it using a for loop or something like that.

swuehl
MVP
MVP

For each vQVD in FileList ('*.qvd')

[Rec Count]:
LOAD
'$(vQVD)' as [QVD Table Name],
QvdNoOfRecords('$(vQVD)') as [No Of Records]
Autogenerate 1;

Next vQVD

sunny_talwar

May be this:

Let vPathName = 'C:\Users\sunny.a.talwar\Downloads\Test\';

For Each File in FileList('$(vPathName)'&'*.qvd')

  Let vQVDName = QvdTableName('$(File)');

  Let vNumRows = QvdNoOfRecords('$(File)');

  [Rec Count]:

  LOAD * INLINE [

     QVD Table Name, No Of Records

     $(vQVDName), $(vNumRows)

  ];

NEXT File

petter
Partner - Champion III
Partner - Champion III

Yes - swuehl just illustrated it ... good luck

Not applicable
Author

Hi Sunny,

As usual appreciate thanks for the quick response.

But the issue here is some qvds are in sub folders as well like:

C:\Users\sunny.a.talwar\Downloads\Test\

C:\Users\sunny.a.talwar\Downloads\Test\Sub\


Any idea how to handle this scenario

Not applicable
Author

Hi Stefan,

But my qvds are in different folders. Any idea how to handle this scenario.

Not applicable
Author

Hi Pavan,

But I have n qvd's and all of them are in different locations.