Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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
Partner - Specialist II
Partner - 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

Anonymous
Not applicable
Author

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