Discussion Board for collaboration on QlikView Management.
Hi Everyone
I'm trying to reload using scheduler QlikView document containing two macros. Macros are used to count files in folder and delete files. Here is example of macro's code:
public function DeleteFile(filePath)
Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim retVal 'as Boolean
If objFSO.FileExists(filePath) Then
Call objFSO.DeleteFile(filePath)
retVal = true
Else
Set objFSO = nothing
retVal = false
End If
DeleteFile = retVal
end function
Locally those macros work fine. But when document is refreshed by scheduler I got general error as a result.
Is there any workaround to launch document on server ?
Regards.
M
The CreateObject("Scripting.FileSystemObject") call requires your module to have System Access. To get System Access from the command line, you have to add the switch /NoSecurity.
QV.exe /r /NoSecurity path_to_qv_file
-Rob
In scheduler macros never work , you need to run through batch file.
Vikas
Thanks for answer. Should I schedule file using system scheduler ?
If possible use an External program task.
Everything in one place and you can use depency also.
Unfortunately still doesn't work. Reload is starting but macro doesn't work. It returns null.
Below is macro's code:
public function countFiles(directoryPath)
Dim noOfFiles,objFSO,objFolder
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder=objFSO.GetFolder(directoryPath)
noOfFiles=0
for each file in objFolder.files
if LCase(objFSO.GetExtensionName(file)="xls") then
noOfFiles=noOfFiles+1
end if
next
countFiles=noOfFiles
end function
Would be grateful for any help.
What is your inparams?
C:\<dir> or for instance z:\<dir> ?
When you run it in Publisher, it will run in service account that may not have the same drive mapping as your user.
I run it using bat file (QV.exe /r path_to_qv_file)
In script I set folder name. Example below:
vFlatFilesPath='C:\ProgramData\QlikTech\Documents\Tesco\Data\FlatFiles'
Let vNoOfFiles=countFiles('$(vFlatFilesPath)');
Regards.
Ok
Does your service account have a license?
What does the logfile say?
Yes it has.
As I said I try to run it using batch file. Log says that variable vNoOfFiles is null (but when run locally it works fine).
Hi,
Can you explain what you mean by "but when run locally it works fine". I would think this would have to be ran on the machine that you are wanting the work done on.
Bill