Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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;
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.
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
Thanks wizardo, I was looking to do the same and have successfully applied your advice.