Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
New-Qlik
Creator II
Creator II

How to restrict one query in application to load only on sundays

Hello,

I have an application where have many dimension and two fact tables , and this application is weekly so it get refrehsed every sunday.

in have below scripts 

1. Select * from customer.qvd

2. select * from transaction_**.qvd(** is a daily qvd meaning transaction_20200304, transaction_20200305,transaction_20200306.qvd etc) n i have restricted it to load once week is complete

3. seelct * from stock_***.qvd( *** is a monthly qvd , like stock_202001, 202002, 202003.qvd though it et referehd daily n data get append in this)

 

Now when i refresh application let say Tuesday than customer qvd will get refreshed ,

transaction will not run show last week(sunday data)

but this stock will show me mondays data also as in stock_202003 monday , tuesday data is dre but i want to run only on sundays n rest week days just dont run this part of query n it should show sunday data .

 

i tried 

if DATE(Today(),'WWWW') = 'Sunday' then run  code , otherwise ******* i wnat to write this else part .

 

can anyone guide .

TIA

3 Replies
Gabriel
Partner - Specialist III
Partner - Specialist III

Hi,

 

I try this

IF WEEKDAY(TODAY()) ='Sun' THEN ........

 

Let us know if it helps

New-Qlik
Creator II
Creator II
Author

Hello,

 

Problem is not IF part , issue is i want to write Else part as 'just load old data'.

i thought i can load sunday's data from main qvd and then store that data in one more qvd . like this 

if will say refresh from main qvd 

else will say refresh from that other qvd. but this doesn't seem to me a smart option. so looking for some suggestions.

 

Thanks

Gabriel
Partner - Specialist III
Partner - Specialist III

Hi,

I don't think there is another option than IF statement. So

IF WEEKDAY(TODAY()) = 'Sun' THEN

      code goes there

ELSE

LOAD * FROM [lib://SourceFile/Customers.txt]; // you can then add any WHERE clause here if needed

END IF