Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to use QvdCreateTime to check if a qvd exists without the exact path.

Hello again,

I'm making a load that checks if there are any qvds in the my project folder using the QvdCreateTime function, but it doesn't let me use a path that contains '*' in it. My test goes like this:

IF IsNull(QvdCreateTime('D:\ProjectFolder\QVD\*.QVD')) = -1 THEN...

Is that any way to make it work? Or any other that solves better this problem?

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Try something like

Let vQVDExists = 0;


For Each vFile in FileList ('D:\ProjectFolder\QVD\*.QVD')


Let vQVDExists = 1;


Next vFile


If vQVDExists = 1 THEN ...



View solution in original post

7 Replies
swuehl
MVP
MVP

Try something like

Let vQVDExists = 0;


For Each vFile in FileList ('D:\ProjectFolder\QVD\*.QVD')


Let vQVDExists = 1;


Next vFile


If vQVDExists = 1 THEN ...



Not applicable
Author

Thank you, that works.

Not applicable
Author

I don't know if I'm doing it wrong but, once vFile is filled, even if I erase all the qvds in the folder it still finds the same one every time unless I change the name of the variable... And reopening the application doesn't clean the variable either... Have you seen this before?

swuehl
MVP
MVP

Not sure I fully understand, Moises, are you saying that you vQVDExists = 1 also when there are no QVD files?

Or are you just saying, that the vFile variable keeps stating the last found file name?

I think latter is what I would expect.

Not applicable
Author

Exactly, the variable vQVDExists keeps receiving 1 whether or not there are files in the folder, except for the first time the script is reloaded, when it works well and vQVDExists returns 0, once the vFile is "used" one time, it always return the same qvd file found in the first reload, existing or not in the folder.


Sorry for my english, I'm from Brazil and maybe I'm still thinking in portuguese grammar when writing...

swuehl
MVP
MVP

Moises,

I have tested the code on QV12 IR and QV11.20 SR11 (both X64) using something like

Let vQVDExists = 0;

For Each vFile in FileList ('E:\Users\Stefan\Downloads\*.QVD')

Let vQVDExists = 1;

Next vFile

If vQVDExists = 1 THEN

TRACE Yep, QVDs found!;

ENDIF

TRACE $(vFile);



QVDs were found and I got the TRACE output. Then I changed the search pattern to 'E:\Users\Stefan\Downloads\*.aaQVD'

and the TRACE output for found QVD is now missing. In both cases, the same vFile variable value will be shown (that's what I expect).

So I can't reproduce what you are observing.

On which version are you?

Can you post a sample QVW, so I can run your code?

Regards,

Stefan

Not applicable
Author

Hello there, I don't know if was something stuck on cache (if it has a cache for variables like that), but the bug kind of gone today when I got back to it... I ran some tests again and it went ok... So thank you again for the attention. Problem solved. =]