Triggering task on QMC upon file arrival

Basically it’s two step process:

  1. Creating batch file &
  2. Creating ‘External Program’ task on QMC

Taking bottom-up approach for easier understanding/explanation sake.

2. Batch command template and example (used here):

“Batch_File_Path” “Sharepath_to_poll_with_file_format” Idle_time Time_limit_for_polling

“D:\QlikView\QlikView Source Documents\batch\FilePolling.bat” “\\Sharepath\Token\*.txt” 600 20:00

Create ‘External Program’ task on QMC, use above batch template for ‘Command line statement’.

FilePoling1

 

  1. Batch File code:

REM REM is comment statement in batch file
REM Displaying values passed to the batch file
echo off
echo file_name %1
echo time_polling %2
echo end_time %3

REM Terminate if there are no parameters
if (%1) == () (exit /b 0)

REM This loop will break on two conditions 1. On seeing file 2. Upon time out
:Loop
If exist %1 (exit /b 0)
If %TIME: =0% GTR %3 (exit /b 1)
REM Timeout /T TIME >NUL is sytax. TIME is replaced by second parameter in this code. >NUL means 1>NUL default output 2>NUL default error output. Default output for this code is nothing.
Timeout /T %2 > NUL
Goto Loop