<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Task Reloads: How to restrict task reloads to only load between 9am and 3pm daily every hour? in Management &amp; Governance</title>
    <link>https://community.qlik.com/t5/Management-Governance/Task-Reloads-How-to-restrict-task-reloads-to-only-load-between/m-p/1730240#M16412</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;In our Swedish team we want to create a task that only reloads on from 9am to 3pm daily every hour?&lt;/P&gt;&lt;P&gt;So every day it would reload at 9, 10, 11, 12, 13, 14, and finally at 15:00 for the final load.&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 01:49:09 GMT</pubDate>
    <dc:creator>jblomqvist</dc:creator>
    <dc:date>2024-11-16T01:49:09Z</dc:date>
    <item>
      <title>Task Reloads: How to restrict task reloads to only load between 9am and 3pm daily every hour?</title>
      <link>https://community.qlik.com/t5/Management-Governance/Task-Reloads-How-to-restrict-task-reloads-to-only-load-between/m-p/1730240#M16412</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;In our Swedish team we want to create a task that only reloads on from 9am to 3pm daily every hour?&lt;/P&gt;&lt;P&gt;So every day it would reload at 9, 10, 11, 12, 13, 14, and finally at 15:00 for the final load.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 01:49:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Management-Governance/Task-Reloads-How-to-restrict-task-reloads-to-only-load-between/m-p/1730240#M16412</guid>
      <dc:creator>jblomqvist</dc:creator>
      <dc:date>2024-11-16T01:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: Task Reloads: How to restrict task reloads to only load between 9am and 3pm daily every hour?</title>
      <link>https://community.qlik.com/t5/Management-Governance/Task-Reloads-How-to-restrict-task-reloads-to-only-load-between/m-p/1730244#M16413</link>
      <description>&lt;P&gt;Is this for qlik Sense Enterprise or Saas?&lt;/P&gt;&lt;P&gt;I don't have access to Enterprise QMC right now, but pretty sure they still don't have only run during "business hours" functionality.&amp;nbsp;&lt;/P&gt;&lt;P&gt;You've got a few options&lt;/P&gt;&lt;P&gt;1. Set your task to reload hourly and have a condition or sub routine in your script that will only run when the hour is between 9-15.&amp;nbsp; Benefit of this, it is still all self contained and everything is in one place with one task.&lt;/P&gt;&lt;P&gt;2. Leave your current script as is.&amp;nbsp; Create a new qvf and task with few lines of script checking the hour.&amp;nbsp; Have this scheduled to reload hourly. Chain the other QVF after this one.&amp;nbsp; If this script loads, then success, if not, you'll get an annoying fail flag that lingers for hours until the next time it successfully reloads.&amp;nbsp; The benefit of this is at a glance you can tell if it has reloaded or not without going into the dashboard and checking, because of the big red fail flag on the prior task.&lt;/P&gt;&lt;P&gt;3. Set up multiple daily reloads on the one tasks to run for each of the hours you want.&lt;/P&gt;&lt;P&gt;This is a fairly old issue so there are quite a few solutions lurking in community:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/t5/Qlik-Sense-Deployment-Management/QlikSense-reload-only-during-business-hours-a-quick-and-dirty/m-p/1392766" target="_blank"&gt;https://community.qlik.com/t5/Qlik-Sense-Deployment-Management/QlikSense-reload-only-during-business-hours-a-quick-and-dirty/m-p/1392766&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/t5/New-to-Qlik-Sense/Task-Reload-Load-every-3-hours-between-0600-and-1800/td-p/5836" target="_blank"&gt;https://community.qlik.com/t5/New-to-Qlik-Sense/Task-Reload-Load-every-3-hours-between-0600-and-1800/td-p/5836&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jul 2020 11:45:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Management-Governance/Task-Reloads-How-to-restrict-task-reloads-to-only-load-between/m-p/1730244#M16413</guid>
      <dc:creator>squeakie_pig</dc:creator>
      <dc:date>2020-07-23T11:45:42Z</dc:date>
    </item>
    <item>
      <title>Re: Task Reloads: How to restrict task reloads to only load between 9am and 3pm daily every hour?</title>
      <link>https://community.qlik.com/t5/Management-Governance/Task-Reloads-How-to-restrict-task-reloads-to-only-load-between/m-p/1731904#M16443</link>
      <description>&lt;P&gt;There are a few ways to tackle this problem. I'll outline a couple. If I had to do this myself and potentially do this multiple times, I'd go with the scripted method (option 2). But strictly speaking Qlik's underlying Repository API supports cron syntax which exposes this style of capability if you're comfortable making API calls.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT size="5"&gt;Option 1 - Inside Qlik, Chained tasks&lt;/FONT&gt;&lt;BR /&gt;As&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/18796"&gt;@squeakie_pig&lt;/a&gt;&amp;nbsp; pointed to, handling this in the script itself in a chain is one way. The pro of this is that it's easy to implement. I'd imagine you'd basically have a if/else check with the non specified hours using a syntactically invalid script to cause a failure. The con though is that you're going to have the parent task fail throughout the day. It's super easy to implement but ultimately a bit dirty.&lt;/P&gt;&lt;P&gt;&lt;FONT size="5"&gt;Option 2 - Scripted Approach&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Another method would be to externalize the task triggering. This can be easily accomplished in Windows PowerShell using Qlik-Cli (&lt;A href="https://github.com/ahaydon/Qlik-Cli-Windows" target="_blank"&gt;https://github.com/ahaydon/Qlik-Cli-Windows&lt;/A&gt;). Then use the Windows Task Scheduler to execute the PowerShell script every hour (see &lt;A href="https://github.com/levi-turner/1400da7e-fbda-4a02-aa84-a63209c2aa02" target="_self"&gt;here&lt;/A&gt; for a pointer on the Task Scheduler bits). The pro here is that it's pretty darn easy to repeatedly use this. Example Script:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;$hourBegin = '9' # Start Hour
$hourEnd = '15' # End hour
$taskId = '2749be11-f67e-4e1f-ad8c-b0037e9f72ff' # Target Task's ID
if ((Get-Date).hour -ge $hourBegin -and (Get-Date).hour -le $hourEnd) {
    # True. Current hour is between $hourBegin and $hourEnd
    Connect-Qlik | Out-Null # Connect to Qlik Sense
    Start-QlikTask -id $taskId | Out-Null
} else {
    # False. Current hour is not between $hourBegin and $hourEnd
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="5"&gt;Option 3 - Fully native interacting with the Repository API&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;So this will require some non-trivial API work but the Scheduling bits of the Repository API do allow for sophisticated schedules like you're after. At the outset, you're going to want to have a method for interacting with the Repository API. This (&lt;A href="https://community.qlik.com/t5/Qlik-Support-Knowledge-Base/How-to-configure-Postman-desktop-app-to-connect-to-Qlik-Sense/ta-p/1711499" target="_blank"&gt;https://community.qlik.com/t5/Qlik-Support-Knowledge-Base/How-to-configure-Postman-desktop-app-to-connect-to-Qlik-Sense/ta-p/1711499&lt;/A&gt;) is a good walk through.&lt;/P&gt;&lt;P&gt;Like I mentioned above, the Scheduler allows for cron syntax. Reference&amp;nbsp;&lt;A href="https://crontab.guru/" target="_blank"&gt;https://crontab.guru/&lt;/A&gt;&amp;nbsp;if you want a guide on building this syntax.&lt;/P&gt;&lt;P&gt;The key bits to a time-based trigger (SchemaEvent) is the SchemaFilterDescription field. For an explainer:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;Default: "* * - * * * *"&lt;BR /&gt;This is a list of SchemaFilterDescriptions used to filter when a SchemaEvent is allowed to trigger. An important thing to remember is that what is set as SchemaFilterDescriptions are when it is allowed to trigger and not the opposite.&lt;/P&gt;&lt;P&gt;For Minute, Hour, WeekDay (using numeric values), DayOfMonth and Month you can use syntax with hyphen to state “from - to”. For the others you must state each character to be used in the SchemaFilterDescription, this can of course also be used by Minute, Hour, WeekDay, DayOfMonth and Month as well. Example: You only want to allow the first 15 minutes each hour you can either put ‘1-15’ or ‘1,2,3,4,5,6,7,8,9,10,11,12,13,14,15’ in the first position. There should be no spaces in the SchemaFilterDescription other than between each position, the space character is used as a delimiter between the positions so inserting one would cause the SchemaFilterDescription to, at best, not work as intended or most likely to cause an error.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Starting from left to right (first position is 0) each position is explained below.&lt;/P&gt;&lt;P&gt;Position 0 - Minute&lt;BR /&gt;Legend: 1-60. ‘*’ = all&lt;/P&gt;&lt;P&gt;Which minute of an hour (0 - 60) when the SchemaEvent is allowed to trigger.&lt;/P&gt;&lt;P&gt;Position 1 - Hour&lt;BR /&gt;Legend: 1-24. ‘*’ = all&lt;/P&gt;&lt;P&gt;Which hour of a day (1-24) when the SchemaEvent is allowed to trigger.&lt;/P&gt;&lt;P&gt;Position 2 - WeekDayPrefix&lt;BR /&gt;Legend: 1-4. ‘¤’ = last. ‘-’ = none&lt;/P&gt;&lt;P&gt;WeekDayPrefix works together with WeekDay by adding a prefix. By means of this you can state that only the last (¤) friday in a given month or 1st (1) saturday in a given month is allowed.&lt;/P&gt;&lt;P&gt;Position 3 - WeekDay&lt;BR /&gt;Legend: 0-6 (where sunday is 0)&lt;/P&gt;&lt;P&gt;Which weekday the SchemaEvent is allowed to trigger. See also WeekDayPrefix for further information.&lt;/P&gt;&lt;P&gt;Position 4 - WeeklyInterval&lt;BR /&gt;Legend: An integer. ‘*’ = all&lt;/P&gt;&lt;P&gt;The SchemaEvent is allowed to trigger every n:th week, where n is the number set in this position.&lt;/P&gt;&lt;P&gt;Position 5 - DayOfMonth&lt;BR /&gt;Legend: 1-31. ‘*’ = all. ‘¤’ = last&lt;/P&gt;&lt;P&gt;Which day within a month when the SchemaEvent is allowed to trigger. Using last (¤) the Scheduler will only allow the SchemaEvent to trigger on the last day in a month which is checked dynamically depending on month (and leap year).&lt;/P&gt;&lt;P&gt;Position 6 - Month&lt;BR /&gt;Legend: 1-12. ‘*’ = all&lt;/P&gt;&lt;P&gt;Which month of the year when the SchemaEvent is allowed to trigger.&lt;/P&gt;&lt;P&gt;Examples:&lt;/P&gt;&lt;P&gt;Certain date in month&lt;BR /&gt;Case 1&lt;BR /&gt;Premise: Run the first every month.&lt;/P&gt;&lt;P&gt;SchemaFilterDescription: “* * - * * 1 *”&lt;BR /&gt;Explanation: Position 5 is set to ‘1’ which means the only day number 1 in any given month is allowed for this SchemaEvent.&lt;BR /&gt;This SchemaEvent should increment one day (ie. “0 0 1 0”).&lt;/P&gt;&lt;P&gt;Certain weekdays&lt;BR /&gt;Premise: Run monday and wednesday every week.&lt;/P&gt;&lt;P&gt;SchemaFilterDescription: “* * - 1,3 * * *”&lt;BR /&gt;Explanation: Position 4 is set to ‘1,3’ which means only monday and wednesday are allowed for this SchemaEvent (0 is sunday).&lt;BR /&gt;This SchemaEvent should increment one day (ie. “0 0 1 0”).&lt;/P&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;As for the practical steps:&lt;/P&gt;&lt;P&gt;Step 1: Get the Reload Task information&lt;/P&gt;&lt;P&gt;GET /qrs/reloadtask/7a1bce82-c8f1-438a-a0af-666e27b1553a&lt;/P&gt;&lt;P&gt;Example Response (I've chopped off bits from here which aren't relevant):&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
	"id": "7a1bce82-c8f1-438a-a0af-666e27b1553a",
	...
	"app": {
		"id": "5e34dbc8-bc07-4377-906d-bb370853d731",
		"name": "Random Data",
		"appId": "",
		"publishTime": "2020-06-18T15:01:34.344Z",
		"published": true,
		"stream": {
			"id": "aaec8d41-5201-43ab-809f-3063750dfafd",
			"name": "Everyone",
		"privileges": null
		},
    ...
  },
  "isManuallyTriggered": false,
  "operational": {
    "id": "c1352446-f0b4-484c-a9a2-59bb0156ba03",
	...
    },
    "nextExecution": "1753-01-01T00:00:00Z",
    "privileges": null
  },
  "name": "Super Special Reload",
  "taskType": 0,
  "enabled": true,
  "taskSessionTimeout": 1440,
  "maxRetries": 0,
  "tags": [],
  "privileges": null,
  "schemaPath": "ReloadTask"
}&lt;/LI-CODE&gt;&lt;UL&gt;&lt;LI&gt;You will want the id and operational.id values&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Step 2: Create a SchemaEventOperational. This is a handle for a SchemaEvent which is a time-based trigger.&lt;/P&gt;&lt;P&gt;POST /qrs/schemaeventoperational&lt;BR /&gt;Body: {}&lt;BR /&gt;Example Response:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
  "id": "16e321d5-a869-48bc-8e5e-0b03b9cd4a70",
  "createdDate": "2020-07-29T21:14:40.46Z",
  "modifiedDate": "2020-07-29T21:14:40.46Z",
  "modifiedByUserName": "INTERNAL\\sa_repository",
  "lastEventDate": "1753-01-01T00:00:00Z",
  "nextExecution": "1753-01-01T00:00:00Z",
  "timesTriggered": 0,
  "privileges": null,
  "schemaPath": "SchemaEventOperational"
}&lt;/LI-CODE&gt;&lt;P&gt;Step 3: Create the SchemaEvent. This is the time-based trigger.&lt;/P&gt;&lt;P&gt;POST /qrs/schemaevent&lt;BR /&gt;Example Body:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
  "timeZone": "America/New_York",
  "daylightSavingTime": 0,
  "startDate": "2020-07-09T10:00:00",
  "expirationDate": "9999-01-01T00:00:00",
  "schemaFilterDescription": [
    "* 9-15 - * * * * *"
  ],
  "incrementDescription": "0 1 0 0",
  "incrementOption": 1,
  "operational": {
    "id": "16e321d5-a869-48bc-8e5e-0b03b9cd4a70"
  },
  "name": "Hourly 9A-3P",
  "enabled": true,
  "eventType": 0,
  "reloadTask": {
    "id": "7a1bce82-c8f1-438a-a0af-666e27b1553a",
    "operational": {
      "id": "c1352446-f0b4-484c-a9a2-59bb0156ba03"
      }
    }
  }&lt;/LI-CODE&gt;&lt;P&gt;Notes:&lt;BR /&gt;- operational.id --&amp;gt; From Step 2&lt;BR /&gt;- reloadtask.id &amp;amp; reloadtask.operational --&amp;gt; From Step 1&lt;BR /&gt;- You may very well need to or want to change the timeZone and daylightSavingTime settings.&lt;BR /&gt;- Adjust the startDate value from 09:00:00 to some other minute and second if desired.&lt;/P&gt;&lt;P&gt;Hope that helps&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jul 2020 21:22:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Management-Governance/Task-Reloads-How-to-restrict-task-reloads-to-only-load-between/m-p/1731904#M16443</guid>
      <dc:creator>Levi_Turner</dc:creator>
      <dc:date>2020-07-29T21:22:02Z</dc:date>
    </item>
  </channel>
</rss>

