Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Is it possible Delete a file using a macro Server Side?

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

1 Solution

Accepted Solutions
petter
Partner - Champion III
Partner - Champion III

Here is my minimal test QlikView application that is working

View solution in original post

7 Replies
petter
Partner - Champion III
Partner - Champion III

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.

petter
Partner - Champion III
Partner - Champion III

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

Not applicable
Author

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

petter
Partner - Champion III
Partner - Champion III

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

petter
Partner - Champion III
Partner - Champion III

Here is my minimal test QlikView application that is working

petter
Partner - Champion III
Partner - Champion III

And yes it is quite possible to execute a program too - by using the WScript.Shell object and using the Exec method.

petter
Partner - Champion III
Partner - Champion III

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).