Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hello guys [:)]
I have a question and I think ( and hope) that it quite simple to done.
I'm loading data from an EXCEL file.
after loading the file I want to delete it from the directory its located,how can I do that from that script?
Is it possible to move it to another directory instead of deleting it?
Do I need to use a batch file? ( I really prefer not to)
10X
David
You can create a VBScript function and then call it from your QlikView script just after the load. See enclosed example.
Make sure to change the file paths and give System access in the Macro to be able to delete the file.
Let me know if it helped by verifying the solution.
You can create a VBScript function and then call it from your QlikView script just after the load. See enclosed example.
Make sure to change the file paths and give System access in the Macro to be able to delete the file.
Let me know if it helped by verifying the solution.
The above solution will not work if you are reloading in Publisher, in that case you will need to use a bat file as Pub does not fire off any macros. Just in case you are using Publisher for reloads 🙂
/Karl
It is possible to implement this without macro.
One of my apps reads XML files, and moves them after that into a different folder. Technically not much different from delete. I'm using external batch file for this. This file is called within the reload script by the Execute command.
Just noticed that David doesn't want batch file...
Yes this is another way possible. But then make sure to make a registry adjustment in the server.
See http://community.qlik.com/forums/p/16459/64216.aspx for details.
hi
thanx Rakesh it seem to be working!
Michael,Can you add your solution with the batch file? simultaneously I will check this one
and see if it fits.
Thanx
Here is code line for EXECUTE command prompt commands from script:
Execute cmd /C del /Q "filepath\filename";
Please make sure to make registry adjustments in the server as mentioned in earlier post.
Rakesh, Do I need to build a batch file? if yes,what it contains?
I'm quite new in QV so.....can you please attach an example?
thanx in advance
No, you would put this line in the QVW script just after your load statement:
Execute cmd /C del /Q "filepath\filename";
This line will execute a DOS command "DEL" to delete the file in the quotes with "Q" option for "quietly".
I cannot post my application, and don't have enough time now to create an example, sorry. Here is the description:
I have file move.bat with one line inside, like this:
move Folder1\*.xml folder2\
It moves all xml files from one directory to another. You can use a line here that deletes fiels.
Next, in the QV application script, there is line (after I read the xml data):
EXECUTE move.bat;
The only other things I have to add:
1. Make sure to check "Can Execute External Programs" box on the "Setting" tab of the script editor.
2. On the user preferences, Security - check the box "Script..."
Hope it helps...