Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Read about the latest Qlik Community enhancements on the Community News blog!
cancel
Showing results for 
Search instead for 
Did you mean: 
shoebox1976uk
Contributor III
Contributor III

Do While Loop

I'm not sure if this is a problem with the syntax of my Do...While loop, or with the way I'm using variables in my script, but I've hit a brick wall and need some help.

I am currently writing a trigger mechanism for my Qlikview schedule and need my script to continue running until the trigger file has been altered.

So, I have one variable (vCurrentTriggerDate) taking the timestamp from the actual trigger file, and a second variable taking the timestamp stored in a QVD file (vStoredTriggerDate).

My loop reads like this:

Do while '$(vCurrentTriggerDate)'='$(vStoredTriggerDate)';

          let vCurrentTriggerDate = Filetime('$(vCRSPath)$(vMCPath)TriggerTest.txt');

LOOP;

The idea being, that when the timestamp on 'TriggerTest.txt' changes, the script should drop out of the loop. However, I don't think it is ever re-evaluating the contents of vCurrentTriggerDate, and therefore continues looping forever.

Has anyone got any ideas how to overcome this?

Many thanks

2 Replies
flipside
Specialist II
Specialist II

Hi Andrew,

Try this ...

let vStoredTriggerDate=filetime({file});

let run = 1;

let pass = 1;

Do while run = 1

    if vStoredTriggerDate<>Filetime({file}) then

        let run = 0;

    endif;

    //testing

    trace $(pass): Running;

    sleep 100;

   

    let pass = pass + 1;

           

LOOP;

flipside

shoebox1976uk
Contributor III
Contributor III
Author

Thanks so much for this. Worked a treat (with a little tinkering).