Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

vardhancse
Valued Contributor III

How to get the count of records in QVD

Hi,

Was trying to validate the records count from source->DB->QV(QVD)

creating one dashboard, which shows count of records table wise from source->DB->QVD

Can any one please let me know how to get the count of records in the QVD(Incremental load).

6 Replies
Highlighted
Not applicable

Re: How to get the count of records in QVD

You can simply use the function QvdNoofRows() for this.

From the QV-reference manual:

QvdNoOfRecords(filename)

Returns the number of records currently in a QVD file.

The filename is the name of a QVD file, if necessary including path.

Examples:

QvdNoOfRecords ('MyFile.qvd')

QvdNoOfRecords ('C:\MyDir\MyFile.qvd')

So you can compare this number with the select count(*) FROM yourTable;

vardhancse
Valued Contributor III

Re: How to get the count of records in QVD

Thanks but I am trying to export the count to an excel format not in the QVW.

senpradip007
Valued Contributor III

Re: How to get the count of records in QVD

First Load your QVD(Incremental load). Then you can try with NoOfRows('TableName') or QvdNoOfRecords(filename) function.

Eg:

Tab:

Load *

From <Data Source>;

LET a = NoOfRows('Tab');

Re: How to get the count of records in QVD

You can create a variable in the load script for get the no of records by using NoofRows() or   QvdNoOfRecords ( ) like

Let vQVDRecords = QvdNoOfRecords ('C:\MyDir\MyFile.qvd');

Or

Let vNOOrRecords = NoofRows ('TableName');

Re: How to get the count of records in QVD

Update the script now check

Then try like

TableName:

Load

*

From QVD;

Let vQVDRecords = QvdNoOfRecords ('C:\MyDir\MyFile.qvd'); //It reads from the QVD rows


Let vNoOfRows = NoofRows ('TableName'); //It reads from the table loads

TableRows:

Load * inline

[

QVDRows,TableRows

'$(vNoOfRows)','$(vQVDRecords)'

];

Store TableRows into TableRows.qvd(qvd); //But if you want to create the xls file change syntax but the file not created in xls format it is in txt file and after opening save it as xls file

Store TableRows into TableRows.xls(txt);

Not applicable

Re: Re: How to get the count of records in QVD

Please find attached an example .qvw where I show how it works.

- First I load some data to generate a .qvd (this is to simulate the .qvd you already have).

- then I trace the no of rows so you see it while reloading and in the logging (if activated)

- then this #rows is loaded inline

- then this is stored to a csv file

This could be extended to multiple .qvd's if needed.

Hope it helps.