Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
chrisbrain
Partner - Specialist II
Partner - Specialist II

Testing whether script has write ability before using

I am trying to test whether QlikView can write a file (using the store command) before actually running the remainder of the script.

There seem to be a couple of reasons the store command might fail including:

- The directory or drive doesn't exist

- QlikView does not have write permissions on the location.

I would like to recongnise and handle this gracefully, exiting the script with a message or log command. At present I am trying the following but QlikView simply errors/crashes on the store line even though I have set ErrorMode=0. So I never reach my Trace and exit script line.

Does anybody have a suggestion as how to test this in QlikView?

sub checkFolderAndWriteAccess

          test:

          LOAD * INLINE ;

 

          set ErrorMode = 0;

          store test into 'c:\folder\test.txt' (txt);

          set ErrorMode = 1;

 

          drop table test;

 

          if(ScriptErrorCount > 0) then

         Trace 'Error writing file..';

         exit script;

  endif

end sub

call checkFolderAndWriteAccess;

beeido.com - BI | Software | Qlik Integration Services
GitFirst - A CI/CD solution for Qlik Sense
0 Replies