Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have loaded CSV files into QVW file. Now i have a requirement such that, in load script i have to write the script which will check that whether the files exist in the specified path or not. If not then it will exit the script without any error and if yes then it will transfer the CSV files to some other
How it can be done ??
Hi,
you could test file existence in your loading script as follows
if isnull(filetime('c:\qv\data\myfile.txt')) then
//do nothing
else
//file is actually there, load it
table_1:
LOAD col1,
col2
FROM
C:\QV\data\myfile.txt
(txt, codepage is 1252, embedded labels, delimiter is '\t', msq);
end if
Hope this helps
Hilaire
Hi,
You can use the following script to match your requirement.
if FileSize('$(FileName)')>0 THEN
Load Statements
Else
Exit Script;
ENDIF
Regards
Andrew Hudson
Hi Hilaire,
Its working but now if mthe file is there then it should move to a specified path. How that will be done ??
to move the file to another directory, you can use the syntax shown in Venkat's post above
execute cmd.exe /c move c:\qv\data\myfile.txt c:\qv\data\old\myfile.txt
BTW, using his sample code or taking code samples from Rob Wunderlich's "qlikview cookbook" will make your code more robust if you don't know the file name beforehand
the "move c:\qv\data\myfile.txt c:\qv\data\old\myfile.txt" is actually a DOS command, you can use other dos commands as well (copy, del, ...)
Hilaire