Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
VivenReddy
Partner - Creator
Partner - Creator

Macro to create folder from Ajax Accesspoint

I've searched the community forums and I'm unable to get clarity on this issue.

I need a macro that will create a folder when the user presses a button.  I have been able to get this to work in Qlikview Desktop but I need it to work from Ajax accesspoint.

Here is the macro that I'm using:

sub createFolder
set Var = ActiveDocument.GetVariable("vUserReportFolder")
newfolderpath = Var.GetContent.String
set filesys = CreateObject("Scripting.FileSystemObject")
If Not filesys.FolderExists(newfolderpath) Then
Set newfolder = filesys.CreateFolder(newfolderpath)
rem msgbox("A new folder has been created: " & newfolderpath)
End If
end sub

In the QMC, I have enabled macro execution and unsafe macro execution in security settings.

3 Replies
marcus_sommer

With normal macros it won't be possible. It might be possible with server-side macros. I never used them - just know that there is such a feature. If this kind of action is really supported it would require that the machine on which the server runs and the server-user have the appropriate access rights to the wanted target. I rather doubt that this is case  respectively that your company want to allow it ...

- Marcus

VivenReddy
Partner - Creator
Partner - Creator
Author

Thanks you for responding Marcus. 

Yes I figured I need some sort of server side macro. To export the chart I used ServerSideExport which worked well. Do have any idea on where I can find more  info on the macro that I require?

Currently my company does not mind the user creating the folde. So the appropriate access will be given.

marcus_sommer

I must admit that I have some doubts that you could directly create the folder with the AJAX client even with server-side macros.

It's not quite clear for me what would be the real benefit that users could create a folder through QlikView instead of doing it directly within the explorer. Such a tasks might be also simplified with some links/batches on the user-side.

Nevertheless you might consider some workaround like storing the object within a default-folder on the server and including the path-information within the file-name and each n minutes a windows-tasks checked this folder and move this file to the wanted destination by creating the folder if needed and removing the path-information from the file-name again.

- Marcus