Script suddelny stops on for each loop when executed by QMC task
i have a qlik application which decrypts and unzips files, reads them and then deletes the decrypted files again. It works only when i execute it manually. I tried executing it with the same User as QMC would do it and on the same Server as QMC would do it (QV Server runs on 2 machines,only distribution services runs on the 2nd machine).
But the script stops at the "FOR EACH file in filelist" Loop - which checks how many files are in the directory.
I attached 2 log files, both executed with the same user and on the same machine only difference is manually or QMC task.
Hey Lukas, I think I know what is wrong here, you need to replace
with something like
The service account has no knowledge of mapped drives, so you need to use a UNC path instead, hopefully this will make sense and you are able to create a file share on that location, actually, should already be there now that I think about it as you mapped a drive to it! 🙂 Just use the UNC convention instead of your mapped drive, and I think it will run correctly. When you run things as a service is when stuff like this comes into play, just FYI. One other gotcha here, be sure if there are subfolders in the path that all those folders have the same NTFS permissions, as if one of them in the middle is more restrictive than the others, that could cause issues as well as service accounts have to parse each folder in the path, which is different than a logged on user...
To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question. I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.
i changed the path to a UNC path but that didn't fix the problem.
I also edited the settings.ini file under "C:\Windows\System32\config\systemprofile\AppData\Roaming\QlikTech\QlikViewBatch" and added "AllowExecuteCommand=1".
Now the task doesn't run into an error but it keeps reloading forever. I tried a solution i found on here where i delete the file corresponding to the task under ..\Qliktech\DistributionService\TaskResults but that didn't help either.
Just from the log-files it's quite difficult to detect a possible issue. If loops don't run it's often useful to uncomment various parts and to add them then step by step again to find the breakpoint.
Also give it a try to execute it per qmc when the qmc-user is logged in. It's not mandatory that each single thread which the various sub-routines / EXECUTES might run will work - they might not inherit all the rights from the user and/or there are various libraries/functions which only work within a user-context (if none is logged in the OS takes the default-user which has usually not the appropriate access rights / licences and so on).