Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
jblomqvist
Specialist
Specialist

How to use QVD file functions in the script?

Hi all,

Can anyone please show me how to execute the QVD file functions in QlikView please? I thought it was as simple as putting a filename inside the function but it doesn't work. Can anyone show me simple illustration of how it works in the script or the front end to get some information out of a QVD file please?

QvdCreateTime(filename)

Returns the XML-header time stamp from a QVD file if any (otherwise NULL).

QvdNoOfRecords(filename)

Returns the number of records currently in a QVD file.

QvdNoOfFields(filename)

Returns the number of fields in a QVD file.

QvdTableName(filename)

Returns the name of the table contained in a QVD file.

Can these be used at the front end of the application?

1 Solution

Accepted Solutions
jonasheisterkam
Partner - Creator III
Partner - Creator III

//Create a QVD from Inline Data

QVD_Data:

LOAD * INLINE [

    F1, F2, F3, F4

    a, 1

    b, 2

    c, , X

];

Store QVD_Data into QVD_Data.qvd (qvd);

Drop Table QVD_Data;

//Create Variable

let CT = QvdCreateTime('QVD_Data.qvd');

let NoR = QvdNoOfRecords('QVD_Data.qvd');

let NoF = QvdNoOfFields('QVD_Data.qvd');

let TN = QvdTableName('QVD_Data.qvd');

let FN = QvdFieldName( 'QVD_Data.qvd', 1);

//Load QVD as XML for more Metadata

QvdFieldHeader:

LOAD FieldName,

    BitOffset,

    BitWidth,

    Bias,

    NoOfSymbols,

    Offset,

    Length,

    [NumberFormat/Type] as Type,

    [NumberFormat/nDec] as nDec,

    [NumberFormat/UseThou] as UseThou,

    %Key_QvdTableHeader_B94FCCAC68ED3E20    // Key to parent table: QvdTableHeader

FROM QVD_Data.qvd (XmlSimple, Table is [QvdTableHeader/Fields/QvdFieldHeader]);

LineageInfo:

LOAD Discriminator,

    %Key_QvdTableHeader_B94FCCAC68ED3E20    // Key to parent table: QvdTableHeader

FROM QVD_Data.qvd (XmlSimple, Table is [QvdTableHeader/Lineage/LineageInfo]);

QvdTableHeader:

LOAD QvBuildNo,

    CreatorDoc,

    CreateUtcTime,

    SourceFileSize,

    TableName,

    RecordByteSize,

    NoOfRecords,

    Offset,

    Length,

    %Key_QvdTableHeader_B94FCCAC68ED3E20    // Key for this table: QvdTableHeader

FROM QVD_Data.qvd (XmlSimple, Table is [QvdTableHeader]);

//Load QVD-Data

Data:

LOAD F1,

     F2,

     F3,

     F4

     //You can use Filefunctions like the QVDFileFunktion also outside a load

     ,filename()

     ,filetime()

     ,filesize()

     ,filepath()

     ,fileextension()

     ,filedir()

     ,filebasename()

      

FROM

QVD_Data.qvd

(qvd);

View solution in original post

3 Replies
sudeepkm
Specialist III
Specialist III

you can use an if else statement in your script and you can use the qvd related functions while doing incremental data load from data source using qvds.

to check if a QVD exist you can use like below:

if(QvdCreateTime('path/filename.qvd')>0) then

// code to load from QVD

else

// code to do regular load

end if;

if you have plan to an assessment of multiple QVDs in a folder then you ca run a for loop to loop through multiple QVD names and can get details of the QVD such as no of records, fields, table name etc by using oter QVD related functions.

jonasheisterkam
Partner - Creator III
Partner - Creator III

//Create a QVD from Inline Data

QVD_Data:

LOAD * INLINE [

    F1, F2, F3, F4

    a, 1

    b, 2

    c, , X

];

Store QVD_Data into QVD_Data.qvd (qvd);

Drop Table QVD_Data;

//Create Variable

let CT = QvdCreateTime('QVD_Data.qvd');

let NoR = QvdNoOfRecords('QVD_Data.qvd');

let NoF = QvdNoOfFields('QVD_Data.qvd');

let TN = QvdTableName('QVD_Data.qvd');

let FN = QvdFieldName( 'QVD_Data.qvd', 1);

//Load QVD as XML for more Metadata

QvdFieldHeader:

LOAD FieldName,

    BitOffset,

    BitWidth,

    Bias,

    NoOfSymbols,

    Offset,

    Length,

    [NumberFormat/Type] as Type,

    [NumberFormat/nDec] as nDec,

    [NumberFormat/UseThou] as UseThou,

    %Key_QvdTableHeader_B94FCCAC68ED3E20    // Key to parent table: QvdTableHeader

FROM QVD_Data.qvd (XmlSimple, Table is [QvdTableHeader/Fields/QvdFieldHeader]);

LineageInfo:

LOAD Discriminator,

    %Key_QvdTableHeader_B94FCCAC68ED3E20    // Key to parent table: QvdTableHeader

FROM QVD_Data.qvd (XmlSimple, Table is [QvdTableHeader/Lineage/LineageInfo]);

QvdTableHeader:

LOAD QvBuildNo,

    CreatorDoc,

    CreateUtcTime,

    SourceFileSize,

    TableName,

    RecordByteSize,

    NoOfRecords,

    Offset,

    Length,

    %Key_QvdTableHeader_B94FCCAC68ED3E20    // Key for this table: QvdTableHeader

FROM QVD_Data.qvd (XmlSimple, Table is [QvdTableHeader]);

//Load QVD-Data

Data:

LOAD F1,

     F2,

     F3,

     F4

     //You can use Filefunctions like the QVDFileFunktion also outside a load

     ,filename()

     ,filetime()

     ,filesize()

     ,filepath()

     ,fileextension()

     ,filedir()

     ,filebasename()

      

FROM

QVD_Data.qvd

(qvd);

jblomqvist
Specialist
Specialist
Author

Thank you Jonas I think it identified where I was going wrong