Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am using the below code to delete a file on a server if it is present. This exact code works in View but not in Sense. I have enabled Legacy Mode in Sense, so that doesn't seem to be the issue:
SET vQvdFile = '\\Server1\QlikView\Operations\Master\Loader\QVD\Embrace$(vCurrentYear)Q$(vCurrentQuarter).qvd';
TRACE $(vQvdFile);
LET vFileDeleted = (DeleteFile('$(vQvdFile)') = -1);
// 0 = false
// -1 = true
TRACE File deleted $(vFileDeleted) : -1 = true, 0 = false;
At design time, Sense highlights the open bracket after "DeleteFile" in red and underlines it. During runtime the following error message shows:
The following error occurred:
Unexpected token: '(', expected one of: ')', ':', 'OPERATOR_PLUS', 'OPERATOR_MINUS', 'OPERATOR_MULTIPLICATION', 'OPERATOR_DIVISION', 'OPERATOR_STRING_CONCAT', ...
The error occurred here:
LET vFileDeleted = (DeleteFile>>>>>>(<<<<<<'\\Server1\QlikView\Operations\Master\Loader\QVD\TESTING\Embrace2022Q2.qvd') = -1)
Any help would be appreciated as I am not sure how to interpret this error.
Thanks
J
To the best extent of my knowledge, there is no DeleteFile() function in Qlik (Sense or View). Is this perhaps a customized VBscript function you created in QV?
If you want to delete a file from script in QS, I believe you need to execute an operating system command, e.g.
Execute cmd.exe /C del "FileName.qvd";
To the best extent of my knowledge, there is no DeleteFile() function in Qlik (Sense or View). Is this perhaps a customized VBscript function you created in QV?
If you want to delete a file from script in QS, I believe you need to execute an operating system command, e.g.
Execute cmd.exe /C del "FileName.qvd";
It works indeed. I can even put $() variables into the filename string:
Execute cmd.exe /C del "\\WNLBI01\QlikView\Operations\Master\Loader\QVD\TESTING\Embrace$(vCurrentYear)Q$(vCurrentQuarter).qvd";
Thanks for the assistance!
J