Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I have an application published in my server and I want delete a file (.csv, saved in same server) using a macro, is it possible do it? I don't know, maybe exist something like ServerSideExportEx (to export file into a server)...
I use QlikView 11.20 SR10 and IEplugin.
Many Thanks,
Fabio
Here is my minimal test QlikView application that is working
It is possible given that you have set up the application and the server to allow this according to security settings. You can take advantage of the FileSystemObjects component in VBScript where you have access to various file operations that you can perform.
Sub CreateFile
Set fso = CreateObject("Scripting.FileSystemObject")
fso.CreateTextFile "D:\temp\somefile.txt", -1
End Sub
Sub DeleteFile
Set fso = CreateObject("Scripting.FileSystemObject")
fso.DeleteFile "D:\temp\somefile.txt"
End Sub
In the Edit Module of your QlikView Application you should set:
Requested Module Security = System Access
Current Local Security = Allow System Access
Furthermore on the QlikView Server you have to adjust these two settings in the
System/Setup/QlikView Servers/<servername>/Security (tab):
Allow unsafe macro execution on server
Allow macro execution on server
Hi Petter,
I have tested the proposal solution:
Sub DeleteFile
Set fso = CreateObject("Scripting.FileSystemObject")
fso.DeleteFile "D:\temp\somefile.txt"
End Sub
When I run the application in my access point, the istruction fso.DeleteFile "D:\temp\somefile.txt" delete (or try to delete) the file D:\temp\somefile.txt in my pc and not in server folder (my target).
If is it impossible to do this via macro istrucion (fso.DeleteFile "D:\temp\somefile.txt"), can I run a cmd command (cmd.exe /c del D:\temp\somefile.txt) by macro or by action?
Many thanks for your support!
Fabio
Actually I have two computers where I am able to do this by running Chrome Browser on Computer1 accessing the AccessPoint on Computer2 that is running the QlikView Server and AccessPoint and I am able to Create and Delete a file from Computer1 on Computer2.
So it must be the settings I mentioned at the end of my previous post that has to be adjusted... It works in my environment.
- Petter
Here is my minimal test QlikView application that is working
And yes it is quite possible to execute a program too - by using the WScript.Shell object and using the Exec method.
I am able to use the app from my Android phone and my iPad - creating and deleting files on the server. You should however make sure that the QlikView Server account that is running have the rights to do the file operations in the folder that you are using for the file(s).