Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a Qlikview Extract with 3 tabs of code. The extract runs daily. One of the tabs only needs to be executed during specific intervals - say, the months of January and July each year.
At present, it's a case of manually uncommenting the code at the beginning of each period, and then commenting it out again at the end of the period.
This is obviously not a huge hassle, but we may produce more date-dependent script tabs for other dashboards in the future, so I was wondering if this could be automated.
Can an IF statement be added to the top of the script tab saying If the current date has the month of Jan or July, then run the code, else skip this tab?
If necessary, I could move this tab so it is the last in the QVW, so rather than 'skipping' a tab, I could put the IF statement in the preceding tab, and add an Exit Script - i.e. If current month is not Jan or July, then exit script, else continue.
Or... if this cannot be added in the script tab itself, perhaps I could make each script tab into a subroutine, and then have an extra tab at the beginning that checks the system date and only calls the SUBs that fit the date criteria?
Thanks,
G
Perfect, thanks. Easy as that, eh?
Ok, bonus questions - say I have an Extract QVW that runs hourly and has 3 tabs of code. If I wanted one of the code tabs to only run once a day, say on its 11am execution, could I do something similar but using a time query? Something like:
IF Time(Now(1)) >=11:00:00 AND Time(Now(1)) <12:00:00 THEN
~daily code~
END IF
Also, what would the reverse be? i.e. could I just add a NOT?
IF NOT (Time(Now(1)) >=11:00:00 AND Time(Now(1)) <12:00:00)
?
Many thanks.
Of course, I could have two separate QVWs running on different schedules, so this is just out of interest.