Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

QVD Filtering

Hello,

as a complement to the post "http://community.qlik.com/forums/p/29947/115092.aspx#", i would like to


FOR each qvdFile in filelist ('*.qvd')

LET vFileName = FileName('$(qvdFile)');
'$(vFileName)':
LOAD ID,
DATE(DATE) as DATE,
[HEURE DEB],
[HEURE DEB1],
PTF,
HOST,
[TRAP ID],
TYPE,
NIV,
MESSAGE
FROM
$(qvdFile)(qvd)
WHERE NIV='ERROR' OR NIV='FATAL';

STORE $(vFileName) INTO $(vFileName)_mod.qvd (qvd);
NEXT qvdFile;


error loading image

The issue is that i get errors while loading....

Using the DEBUG mode, i discover the "LET vFileName = FileName('$(qvdFile)');" that vFileName has as value "",
which seems to trigger the issue.

Can anyone help me ?

Thanks in advance.

2 Replies
wizardo
Creator III
Creator III

hi there

the problem is that the function you are using "filenam()" can only be used inside load statement as it returns the name of the file currently been read.

since your using it before the load statement , it is empty hence you get the rest of the script in error.

what you need to do is extract the file name with out the path from the variable "qvdFile" that is used in the "for each" loop

you can use it like this:

replace this line in your code:

LET vFileName = FileName('$(qvdFile)');


with this line
LET vFileName = right('$(qvdFile)',len('$(qvdFile)')-index('$(qvdFile)','\',-1))

i think this should do the trick
Not applicable
Author

Thanks wizardo, I was looking to do the same and have successfully applied your advice.