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

QlikSense: reload only during business hours - a 'quick and dirty' setup/workaround

Hi everyone,

I needed an option of running tasks on 15min-basis and hourly-basis only during business hours. However, it seems that the only option in QlikSense is to set one 'weekly' task for each execution, i.e. 4 tasks for each hour needed to run in the 15-min option and one task per hour for hourly run, for ALL tasks).

Obviously, there had to be a better way around this and I thought about a functional, albeit 'unelegant' manner to quickly and easily configure this. Until Qlik rebuilds this option into Sense QMC (as in QlikVIew) or I become an Engine API expert (always think positive), I think this setup should work.

Create and publish in a private stream an app with the following script:

SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';

LET vSOBD = NUM(MakeTime(02,00));

LET vCOB = NUM(MakeTime(21,30));

IF (WeekDay(TODAY()) <> 'Sat' AND WeekDay(TODAY()) <> 'Sun') AND (FRAC(Time(NOW())) >= $(vSOBD) AND FRAC(Time(NOW())) <= $(vCOB)) THEN

EXIT SCRIPT;

ELSE

LOAD FAIL FROM ERROR;

END IF;

This script takes one second to reload in both IF and ELSE scenarios. Reading from the script, it might have become obvious what I am trying to do and also why it is 'unelegant'.

The vSOBD and vCOB variables are where you set business start hours and end hours and you can also change the day of run to Weekdays and exclude any specific day, e.g. in this case weekends.

If it is during a business day and hour you have set, it will 'exit script'. If it isn't a business day and hour, it will fail. This is the 'unelegant' part, as I hate to see 'red' X on my QMC Tasks.

However, you can quickly create tasks, which reloads every X hours or X mins and then attach all proper reloads on the 'successful completion' of the respective X-hours or X-mins task.

Hope this helps whilst waiting for a true solution.

Have fun,

Cheenu

2 Solutions

Accepted Solutions
Albert_Candelario

Hello @cheenu_janakira ,

Is this new feature of the customer triggers what you are looking for?


How To Create Custom Scheduled Triggers in Qlik Se... - Qlik Community - 1897590

Reload tasks - Custom option ‒ Qlik Sense for administrators

 

I think it is. Have a look so you can run task only during the working hours.

Cheers,

Albert

Please, remember to mark the thread as solved once getting the correct answer

View solution in original post

bartdeboed
Partner - Contributor III
Partner - Contributor III

Thank you @Albert_Candelario , this was exactly what I've been looking for!

I have been testing this and would like to report a bug. If you make a custom scheduled trigger and you disable it, then it reverts back to a non-custom trigger (hourly for example). This way you lose all information about the planned hours, if applied. I'll also report it the official way.

Edit: it's not only when disabling it, but also when changing the name for example.

View solution in original post

5 Replies
bartdeboed
Partner - Contributor III
Partner - Contributor III

Hi Cheenu,

 

I'm currently working with a similar method and it works excellent when the apps use a staging layer made of QVD's. However, when an app directly loads data from a source, an exit script leads to an empty app and therefore no visualisations. Did you find a better method that prevents the app from loading at all and therefore keeping the currently loaded data?

kswindlehurst
Contributor III
Contributor III

You could split the script and visualizations into 2 apps and use binary loading in lieu of a QVD layer.   Still have to chain the tasks, so it's still a workaround.

Albert_Candelario

Hello @cheenu_janakira ,

Is this new feature of the customer triggers what you are looking for?


How To Create Custom Scheduled Triggers in Qlik Se... - Qlik Community - 1897590

Reload tasks - Custom option ‒ Qlik Sense for administrators

 

I think it is. Have a look so you can run task only during the working hours.

Cheers,

Albert

Please, remember to mark the thread as solved once getting the correct answer
bartdeboed
Partner - Contributor III
Partner - Contributor III

Thank you @Albert_Candelario , this was exactly what I've been looking for!

I have been testing this and would like to report a bug. If you make a custom scheduled trigger and you disable it, then it reverts back to a non-custom trigger (hourly for example). This way you lose all information about the planned hours, if applied. I'll also report it the official way.

Edit: it's not only when disabling it, but also when changing the name for example.

Albert_Candelario

Thanks @bartdeboed. I am glad I could help.

Thanks for sharing this behaviour and I do see you already reported it via a Support case. We will also share the outcome of the investigation here, so the rest of the Community can also have visibility of it.

Cheers,

Albert

Please, remember to mark the thread as solved once getting the correct answer