Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Karim_Khan
Creator III
Creator III

How to get specific qvds date time

Hi All,

     I am using below script for getting the qvd's updated time but in my path there are n-numbers of qvds are there I want some specific qvds date n time I have tried to add below code but its not working?

L

Let vQVDPath = '....\qvd';

A:

LOAD QVD_NAMES AS QVDTableName

FROM

[QVD_List.xlsx]

(ooxml, embedded labels, table is Sheet1);

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

B:   

     Load

      FileName() as TableName

      ,FileTime() as FileCreateTime

      ,QvdCreateTime('$(File)') as QVDCreateTime

      ,SubField(SubField('$(File)','\',-1),'.',1) as QVDTableName

     From [$(File)] (qvd);

Next File

Regards,

KK

New to QlikView

KK
11 Replies
Colin-Albert

Let vQVDPath = '....\qvd';  is this line correct?

Should it be Let vQVDPath = '..\qvd'; or Let vQVDPath = '..\..\qvd';

Try adding  trace commands to see if your variables are being created correctly, and enable the document log

Also add $() around vQVDPath to force the variable to be evaluated.

trace FilePath is [$(vQVDPath) & '\*.qvd')] ;

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

trace File is [$(File)] ;

B:  

     Load

      FileName() as TableName

      ,FileTime() as FileCreateTime

      ,QvdCreateTime('$(File)') as QVDCreateTime

      ,SubField(SubField('$(File)','\',-1),'.',1) as QVDTableName

     From [$(File)] (qvd);

Next File

Karim_Khan
Creator III
Creator III
Author

Colin Thanks for your reply but my concern is for exists clause use with in line file.

KK
prieper
Master II
Master II

Do you need only the info of the files from your Excel-List? Then the second part is misleading.

Try (aircode):

FOR i = 0 TO NOOFROWS('A') -1

LET sFile = PEEK('QVDTableName', i, 'A');

TableInfo:

LOAD

FILENAME('$(sFile)')               AS TableName,

FILETIME('$(sFile)')                    AS FileCreateTime,

..... etc

NEXT i

Karim_Khan
Creator III
Creator III
Author

Hi Peter,

have tried ur code also but after that excel code is not getting executed

A:

LOAD QVD_NAMES

FROM

[\.....\QVD_List.xlsx]

(ooxml, embedded labels, table is Sheet1);

FOR i = 0 TO NOOFROWS('A') -1

LET sFile = PEEK('QVDTableName', i, 'A');

TableInfo:

LOAD

FILENAME('$(sFile)')     AS TableName,

FILETIME('$(sFile)')     AS FileCreateTime;

NEXT i

KK
prieper
Master II
Master II

What is not working?

Does the Excel have complete pathnames?

prieper
Master II
Master II

Also the PEEK has to refer to the name in the Excel, i.e. QVD_NAMES

Kushal_Chawda

how values look like in  QVD_NAMES excel file.. is it Qvdname.qvd or just Qvdname?

Colin-Albert

You refer to "exists" and "inline" in your reply, but your example script does not use a "Where exists" clause nor an inline load. Can you clarify?

Have you tried stepping through your load script using Debug mode?

This would help as it would expand each line to show how the variables re being expanded and would identify which line of the script is erroring.

Can you then come back with any specific errors rather than simply saying "it is not working".

Which line is erroring?

Does the vQVDPath variable hold the expected value?

Does the File variable hold the correct filenames?

Are the fields QVDCreateTime, QVDTableName etc. holding valid data?

Karim_Khan
Creator III
Creator III
Author

I had missed path sorry

KK