Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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?
//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);
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.
//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);
Thank you Jonas I think it identified where I was going wrong