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

Script only load if new data in last 5 minutes

hi all,

simple question i hope!

im looking to put in a statement at the beginning of a qlikview script where it will look at my SQL date/timecolumn and if there is a time/date recorded that is within the last 5 minutes  then it will load all, if not it will fail the script.

i know i could put in a simple where clauses but i need it to fail if there is no date/time recorded in the last 5 minutes.

 

any ideas?

 

thanks

 

5 Replies
MayilVahanan

Hi @BSCIknowlec 

Try like below

table:
LOAD * from yourtable where condition;

LET a = NoOfRows('table');

if $(a)=0 then
EXIT SCRIPT;
ENDIF;

If the no.of rows in ur table is zero , then it will end the script.

 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Stephenns
Contributor
Contributor

This allows the majority of page content (like images, tables, text) to be loaded and rendered first. The user sees content loading, so the page looks responsive. At this point, the heavy javascripts can begin loading near the end.

 

upsers

BSCIknowlec
Contributor III
Contributor III
Author

Hi Mayril, thanks for your suggestion. however i need the script to actually fail and not just end the run, as in my qmc i will have my much larger app only run if this smaller app is successful, and if i just put an exit script it would always be successful.  my current code is: 

test:

load *;

if alt( NoOfRows('Update_Time,'), 0)  < 1  then   asdfkjsdflkks(any wrong command); end if

 

SQL Select ID, Update_Time, detail .... from...  where Update_Time >= dateadd(minute, datediff(minute, 0, getdate()) -5, 0)
order by Update_Time desc;

however when i run it always fails? i need it to pass if my update time table(or any table) has data in it

 

any suggestions?

 

thanks 

 

johnreena
Contributor
Contributor

This allows most of the page content (e.g. images, spreadsheets, text) to be downloaded and displayed first. The user sees the content being uploaded to make the page look relevant. At this point, heavy javascript may start loading at the end.

Krnl Download

Krnl Roblox

Krnl

marcus_sommer

Instead of exit script; within the if-loop you could simply write: no current data available and now the script failed ... Any invalid statement will do the job.

- Marcus