Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
tommyl
Creator
Creator

Conditional load with do while

Hello,

I am trying to make a loop in the load script, by checking a field's value in a table. I wrote this loop:

 

SELECT status
FROM [schema].[table];
let vSwitch = fieldvalue('status', 1);

do while ('$(vSwitch)'='false')
sleep 900000;
SELECT status
FROM [schema].[table];
let vSwitch = fieldvalue('status', 1);
exit do when ('$(vSwitch)'='true');

loop ;

 

But i cannot pass to the exit do part. Could anyone please help me on the problem? 

Regards,

3 Replies
Kushal_Chawda

loop seems to be fine. what you are trying to achieve?

Kushal_Chawda

tommyl
Creator
Creator
Author

Hello Kush,

What  i am trying to do is:

During the table creation on hive, if my auto load and hive table creation times collides; i get load error if any of my tables does not exist.

That's  why i read a table with only displaying "True" or "False" values (which shows tables are ready or not). The required steps are:  

1. If the value is "False" i want my script to be "sleep" for a while. 

2. check the table value again, if still "False", sleep again and check again. 

3. Until the table's value turns to "True", continue to do this. If it is "True", i want the load continue with reading the other table's data. 

 

Deletion of $ didnt work either.

Regards,