<?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 Re: 'How to create a task with PARTIAL Reload' using QMS API? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/How-to-create-a-task-with-PARTIAL-Reload-using-QMS-API/m-p/476754#M1270300</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13.3333px;"&gt;Hi&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;, &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="color: #ff0000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;this is for partial reload without the publisher&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;ill assume you know how to use the API,&lt;BR /&gt;it helps to search the 'QMS API Documentation', you can find it here -&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;A href="https://community.qlik.com/docs/DOC-2683"&gt;QMS API Documentation - Version 11&lt;/A&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;in the api if you search 'partial' you get 'TaskReloadMode Enumeration' so from that we understand there might be a chance (-:.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;lets look at 'C:\ProgramData\QlikTech\DistributionService\Tasks' there we can see the xml of all the tasks, and we can also find the task ID so we can delete the task or run it&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;creating partial reload starting from a point where we have no tasks at all (you can have tasks but just for this example):&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;1. create the first task by going to: QMC -&amp;gt; Documents -&amp;gt; select the document we want to partial reload (development.qvw) -&amp;gt; Reload tab -&amp;gt; choose any: i did: Daily -&amp;gt; Apply&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;a file was created in the task folder with the name: 'Task_39614ba7-0628-4264-ac31-b553ba3a0862.xml'&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;2. go to: Status -&amp;gt; Tasks -&amp;gt; verify a task was indeed created 'Reload of Development.qvw'&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;3. open visual studio and run the following code: (some changes is needed to adjust for your file, here we want to apply it to 'Development.qvd')&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;PRE __default_attr="c#" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14447401261118345" jivemacro_uid="_14447401261118345" modifiedtitle="true"&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;// Initiate backend client&lt;/P&gt;
&lt;P&gt;IQMS apiClient = new QMSClient();&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;// Get a time limited service key&lt;/P&gt;
&lt;P&gt;ServiceKeyClientMessageInspector.ServiceKey = apiClient.GetTimeLimitedServiceKey();&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;// &lt;SPAN style="color: rgba(0, 0, 0, 0); font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;"&gt;Get QlikView Server&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;ServiceInfo qds = apiClient.GetServices(ServiceTypes.QlikViewServer).FirstOrDefault();&lt;/P&gt;
&lt;P&gt;DocumentNode document = apiClient.GetUserDocuments(qds.ID).Where(x =&amp;gt; x.Name.Equals("Development.qvw", StringComparison.OrdinalIgnoreCase)).FirstOrDefault(); //Get first source document for this example&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;DocumentTask documentTask = new DocumentTask();&lt;/P&gt;
&lt;P&gt;documentTask.QDSID = qds.ID;&lt;/P&gt;
&lt;P&gt;documentTask.Document = document;&lt;/P&gt;
&lt;P&gt;documentTask.Reload = new DocumentTask.TaskReload();&lt;/P&gt;
&lt;P&gt;documentTask.Reload.Mode = TaskReloadMode.Partial;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;documentTask.General = new DocumentTask.TaskGeneral();&lt;/P&gt;
&lt;P&gt;documentTask.General.Enabled = true;&lt;/P&gt;
&lt;P&gt;documentTask.General.TaskName = "Partial Reload of Development.qvw";&lt;/P&gt;
&lt;P&gt;documentTask.General.TaskDescription = "Creating a task via QMS API";&lt;/P&gt;
&lt;P&gt;documentTask.Scope = DocumentTaskScope.General;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Guid triggerID = Guid.NewGuid();&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;// Create a scheduled trigger&lt;/P&gt;
&lt;P&gt;ScheduleTrigger st = new ScheduleTrigger();&lt;/P&gt;
&lt;P&gt;st.ID = triggerID;&lt;/P&gt;
&lt;P&gt;st.Type = TaskTriggerType.OnceTrigger;&lt;/P&gt;
&lt;P&gt;st.Enabled = true;&lt;/P&gt;
&lt;P&gt;st.StartAt = DateTime.Now;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;// Create a list of trigger and add the scheduled trigger&lt;/P&gt;
&lt;P&gt;List&amp;lt;Trigger&amp;gt; List_Trigger = new List&amp;lt;Trigger&amp;gt;();&lt;/P&gt;
&lt;P&gt;List_Trigger.Add(st);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;documentTask.Triggering = new DocumentTask.TaskTriggering();&lt;/P&gt;
&lt;P&gt;documentTask.Triggering.Triggers = List_Trigger;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;documentTask.Triggering.TaskDependencies = new List&amp;lt;TaskInfo&amp;gt;();&lt;/P&gt;
&lt;P&gt;documentTask.Triggering.ExecutionAttempts = 1;&lt;/P&gt;
&lt;P&gt;documentTask.Triggering.ExecutionTimeout = 360;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;// Scope plays an important role&lt;/P&gt;
&lt;P&gt;documentTask.Scope = DocumentTaskScope.General | DocumentTaskScope.Triggering | DocumentTaskScope.Reload;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;//Create task&lt;/P&gt;
&lt;P&gt;apiClient.SaveDocumentTask(documentTask);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;4. see the task 'Partial Reload of Development.qvw' was created, try running it - NOTHING HAPPENS!, how do we know, because we opened the 'Development.qvw' file in the qlikview client and did Settings -&amp;gt; Document Settings -&amp;gt; General tab -&amp;gt; Generate Logfile &amp;amp; Timestamp in Logfile Name, and no log file was created )-:, now lets run the the 'Reload of Development.qvw', we can see a log file was created,&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;also a new file was created in tasks 'Task_6c92c573-a395-47e2-8e75-a15f0d128b46.xml'.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;5. now here is where the magic happens:&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;a. open both tasks xmls in notepad++ (from 'C:\ProgramData\QlikTech\DistributionService\Tasks')&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;b. make sure you opened notepad++ using 'run as administrator'&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;c. now copy all the data from 'Reload of Development'&amp;nbsp; ('Task_39614ba7-0628-4264-ac31-b553ba3a0862.xml' if we open both xmls the names are inside) to the 'Partial Reload of Development.qvw' ('Task_6c92c573-a395-47e2-8e75-a15f0d128b46.xml') and save the file EXCEPT 'DistributeTask' open node, so basically all the lines except the first two.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;d. restart the 'QlikView Distribution Service' from Start -&amp;gt; Administrative Tools -&amp;gt; Services&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;e. now run the the task - &lt;SPAN style="font-weight: bold; color: #545454; font-family: arial, sans-serif; font-size: small; text-align: right;"&gt;VOILÀ&lt;/SPAN&gt; the task is running!, problem is, its doing a full reload )-:&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;f. open the xml again of the 'Partial Reload of Development.qvw' search for 'LoadType' in the 'SourceDocument' node and change it to 'PartialReload', restart the 'QlikView Distribution Service' again, run the task from the qmc.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;g. if you dont want the trigger in the xml you can remove it otherwise the partial task will run with the trigger settings, this is the line:&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;PRE __default_attr="xml" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14447401261075842" jivemacro_uid="_14447401261075842"&gt;
&lt;P&gt;&amp;lt;ScheduleTrigger ID="0afcc688-06c2-4925-93ac-d153a298cb5d" Enabled="True" EnableDateTime="2014-01-01 00:00:00Z" ExpireDateTime="9999-12-31 23:59:59Z" RecurrenceType="RecurrenceDaily" RepeatEvery="1" HourStart="2014-01-01 02:00:00Z" DayStart="0" RepeatMaxCount="0" /&amp;gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;that's it! you have partial reload&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;you might want to delete some tasks, copy the task ID (name of task is inside the file) and run the code:&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;PRE __default_attr="c#" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14447401261017064 jive_text_macro" jivemacro_uid="_14447401261017064"&gt;
&lt;P&gt;IList&amp;lt;TaskInfo&amp;gt; taskList, docTaskList;&lt;/P&gt;
&lt;P&gt;List&amp;lt;string&amp;gt; taskstoremove = new List&amp;lt;string&amp;gt;();&lt;/P&gt;
&lt;P&gt;taskstoremove.Add("6c92c573-a395-47e2-8e75-a15f0d128b46");&lt;/P&gt;
&lt;P&gt;foreach (var item in taskstoremove)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var taskID = new Guid(item);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var task = apiClient.GetTask(taskID);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; apiClient.DeleteTask(taskID, TaskType.DocumentTask);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (System.Exception ex)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; response.Append(ex.Message);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;/PRE&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;you might want to run the task, this is no problem, create any app, console app or .net app what ever you want and run the code:&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;PRE __default_attr="c#" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14447401260993292 jive_text_macro" jivemacro_uid="_14447401260993292"&gt;
&lt;P&gt;apiClient.RunTask(new Guid("6c92c573-a395-47e2-8e75-a15f0d128b46"));&lt;/P&gt;
&lt;/PRE&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;CAUTION! CAUTION! CAUTION!&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;do not delete any of the xml's (from 'C:\ProgramData\QlikTech\DistributionService\Tasks') deleting them without first delete them from code using 'DeleteTask' will crush 'QlikView Distribution Service' on restart and you wont be able to start the service again after stopping it!!!&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;hope this helped!.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;im not sure this is the only solution, we don't have the Publisher licence so there might be other solutions using the publisher.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;im not sure what happens if you delete the original task the 'Reload of Development.qvd' im too lazy to test it&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;P.S.:&lt;BR /&gt;for some reason i just cant get any of the api methods to return all tasks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;iv tried the api apiClient.GetTasks and the apiClient.GetTasksForDocument while looping over all docs, nothing worked.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;maybe it's because we don't have publisher, finally iv found a work around:&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;PRE __default_attr="c#" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14447401260946539" jivemacro_uid="_14447401260946539"&gt;
&lt;P&gt;// Initiate backend client&lt;/P&gt;
&lt;P&gt;IQMS apiClient = new QMSClient();&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;// Get QlikView Server&lt;/P&gt;
&lt;P&gt;ServiceKeyClientMessageInspector.ServiceKey = apiClient.GetTimeLimitedServiceKey();&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;var serviceList = apiClient.GetServices(ServiceTypes.QlikViewServer);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;List&amp;lt;TaskInfo&amp;gt; taskInfoList = new List&amp;lt;TaskInfo&amp;gt;();&lt;/P&gt;
&lt;P&gt;TaskStatusFilter taskStatusFilter = new TaskStatusFilter();&lt;/P&gt;
&lt;P&gt;taskStatusFilter.TaskStatuses = new List&amp;lt;TaskStatusValue&amp;gt;();&lt;/P&gt;
&lt;P&gt;taskStatusFilter.TaskStatuses.Add(TaskStatusValue.Aborting);&lt;/P&gt;
&lt;P&gt;taskStatusFilter.TaskStatuses.Add(TaskStatusValue.Completed);&lt;/P&gt;
&lt;P&gt;taskStatusFilter.TaskStatuses.Add(TaskStatusValue.Failed);&lt;/P&gt;
&lt;P&gt;taskStatusFilter.TaskStatuses.Add(TaskStatusValue.Running);&lt;/P&gt;
&lt;P&gt;taskStatusFilter.TaskStatuses.Add(TaskStatusValue.Waiting);&lt;/P&gt;
&lt;P&gt;taskStatusFilter.TaskStatuses.Add(TaskStatusValue.Warning);&lt;/P&gt;
&lt;P&gt;List&amp;lt;TaskStatus&amp;gt; taskStatuses = apiClient.GetTaskStatuses(taskStatusFilter, TaskStatusScope.Extended); // A service call.&lt;/P&gt;
&lt;P&gt;foreach (var taskStatus in taskStatuses)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; taskInfoList.Add(apiClient.GetTask(taskStatus.TaskID));&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;/PRE&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;from here you can easily run task by name or what ever. (-:&lt;BR /&gt;iv attached the project solution and the xmls.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;a good way to run the code is to create a console application (EXE) and run it with button macro that runs that application, in this example i compiled a small program that runs the partial reload, it searches for task with the name 'partial' on the 'development' document.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE __default_attr="c#" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14447401260882172" jivemacro_uid="_14447401260882172"&gt;
&lt;P&gt;Sub ScriptPartialReload&lt;/P&gt;
&lt;P&gt;&amp;nbsp; set v = ActiveDocument.GetVariable("vLastPartialReloadAttempt")&lt;/P&gt;
&lt;P&gt;&amp;nbsp; v.SetContent now(),true&lt;/P&gt;
&lt;P&gt;&amp;nbsp; rem msgbox("Partial")&lt;/P&gt;
&lt;P&gt;&amp;nbsp; set v = ActiveDocument.GetVariable("vFileName")&lt;/P&gt;
&lt;P&gt;&amp;nbsp; vFile = v.GetContent.String&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Platform = ActiveDocument.Evaluate("ClientPlatform()")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if isnull(Platform) or Len(Platform)=0 then&lt;/P&gt;
&lt;P&gt;&amp;nbsp; ActiveDocument.PartialReload&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Set shell = CreateObject("WScript.Shell")&lt;/P&gt;
&lt;P&gt;&amp;nbsp; shell.Run "C:\QlikViewTasks\qv-user-manager.exe -t partial -d " + vFile&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end if&lt;/P&gt;
&lt;P&gt;End Sub&lt;/P&gt;
&lt;/PRE&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;this will only work if you &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 10pt; line-height: 1.5em;"&gt;enabling the &lt;/SPAN&gt;&lt;SPAN style="line-height: 1.5em; color: #000000; font-size: 11px; font-style: inherit; font-family: inherit; font-weight: inherit;"&gt;&lt;STRONG&gt;Allow macro execution on server&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 10pt; line-height: 1.5em;"&gt; and&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: inherit; font-size: 10pt; line-height: 1.5em; font-style: inherit;"&gt;&lt;STRONG&gt; &lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 11px; font-family: Tahoma; color: #000000;"&gt;Allow unsafe macro execution on server&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 10pt; line-height: 1.5em;"&gt; on your Qlikview Server Managment Console.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Go to System-&amp;gt;Setup-&amp;gt;Qlikview Servers-&amp;gt;Security tab.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;you might also need to enable macros in the document&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Go to Tools -&amp;gt; Edit Module -&amp;gt; Requested Module Security: System Access, Current Local Security: Allow System Access&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;the final result is:&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;IMG __jive_id="74198" alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/101877_Capture.PNG" style="height: 167px; width: 620px;" /&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;adding in the end of the load script this part unable you to create a smart behavior for the reload button&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;PRE __default_attr="c#" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14447401260857394 jive_text_macro" jivemacro_uid="_14447401260857394"&gt;
&lt;P&gt;IF(IsPartialReload()) THEN&lt;/P&gt;
&lt;P&gt;&amp;nbsp; LET vLastPartialReload = Now();&lt;/P&gt;
&lt;P&gt;ELSE&lt;/P&gt;
&lt;P&gt;&amp;nbsp; LET vLastReload = Now();&lt;/P&gt;
&lt;P&gt;ENDIF&lt;/P&gt;
&lt;/PRE&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;in the reload button properties in 'Enable Condition' write&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;PRE __default_attr="c#" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14447401260813541" jivemacro_uid="_14447401260813541"&gt;
&lt;P&gt;=Interval(vLastPartialReload - vLastPartialReloadAttempt, 'ss') &amp;gt; 0&lt;/P&gt;
&lt;/PRE&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;and now the button will be disabled until the end of the reload process.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Please&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;IMG __jive_id="74202" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/101878_pastedImage_1.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;If you found it helpful (-:.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 25 Dec 2014 09:55:57 GMT</pubDate>
    <dc:creator>yakir_manor</dc:creator>
    <dc:date>2014-12-25T09:55:57Z</dc:date>
    <item>
      <title>'How to create a task with PARTIAL Reload' using QMS API?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-create-a-task-with-PARTIAL-Reload-using-QMS-API/m-p/476753#M1270296</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Team, GM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please help me with an sample 'How to create a task with PARTIAL Reload' using QMS API? and 'How to specify Distribution Folder Path for it? I have looked over and over in API documentations and community forum but failed to get any snipts. It would be great if you share a working code sample or direction to a clear document source. advacne [Thumbs Up].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jan 2026 18:19:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-create-a-task-with-PARTIAL-Reload-using-QMS-API/m-p/476753#M1270296</guid>
      <dc:creator />
      <dc:date>2026-01-26T18:19:17Z</dc:date>
    </item>
    <item>
      <title>Re: 'How to create a task with PARTIAL Reload' using QMS API?</title>
      <link>https://community.qlik.com/t5/QlikView/How-to-create-a-task-with-PARTIAL-Reload-using-QMS-API/m-p/476754#M1270300</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="font-size: 13.3333px;"&gt;Hi&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;, &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="color: #ff0000; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;this is for partial reload without the publisher&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;ill assume you know how to use the API,&lt;BR /&gt;it helps to search the 'QMS API Documentation', you can find it here -&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;A href="https://community.qlik.com/docs/DOC-2683"&gt;QMS API Documentation - Version 11&lt;/A&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;in the api if you search 'partial' you get 'TaskReloadMode Enumeration' so from that we understand there might be a chance (-:.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;lets look at 'C:\ProgramData\QlikTech\DistributionService\Tasks' there we can see the xml of all the tasks, and we can also find the task ID so we can delete the task or run it&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;creating partial reload starting from a point where we have no tasks at all (you can have tasks but just for this example):&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;1. create the first task by going to: QMC -&amp;gt; Documents -&amp;gt; select the document we want to partial reload (development.qvw) -&amp;gt; Reload tab -&amp;gt; choose any: i did: Daily -&amp;gt; Apply&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;a file was created in the task folder with the name: 'Task_39614ba7-0628-4264-ac31-b553ba3a0862.xml'&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;2. go to: Status -&amp;gt; Tasks -&amp;gt; verify a task was indeed created 'Reload of Development.qvw'&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;3. open visual studio and run the following code: (some changes is needed to adjust for your file, here we want to apply it to 'Development.qvd')&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;PRE __default_attr="c#" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14447401261118345" jivemacro_uid="_14447401261118345" modifiedtitle="true"&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;// Initiate backend client&lt;/P&gt;
&lt;P&gt;IQMS apiClient = new QMSClient();&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;// Get a time limited service key&lt;/P&gt;
&lt;P&gt;ServiceKeyClientMessageInspector.ServiceKey = apiClient.GetTimeLimitedServiceKey();&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;// &lt;SPAN style="color: rgba(0, 0, 0, 0); font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;"&gt;Get QlikView Server&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;ServiceInfo qds = apiClient.GetServices(ServiceTypes.QlikViewServer).FirstOrDefault();&lt;/P&gt;
&lt;P&gt;DocumentNode document = apiClient.GetUserDocuments(qds.ID).Where(x =&amp;gt; x.Name.Equals("Development.qvw", StringComparison.OrdinalIgnoreCase)).FirstOrDefault(); //Get first source document for this example&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;DocumentTask documentTask = new DocumentTask();&lt;/P&gt;
&lt;P&gt;documentTask.QDSID = qds.ID;&lt;/P&gt;
&lt;P&gt;documentTask.Document = document;&lt;/P&gt;
&lt;P&gt;documentTask.Reload = new DocumentTask.TaskReload();&lt;/P&gt;
&lt;P&gt;documentTask.Reload.Mode = TaskReloadMode.Partial;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;documentTask.General = new DocumentTask.TaskGeneral();&lt;/P&gt;
&lt;P&gt;documentTask.General.Enabled = true;&lt;/P&gt;
&lt;P&gt;documentTask.General.TaskName = "Partial Reload of Development.qvw";&lt;/P&gt;
&lt;P&gt;documentTask.General.TaskDescription = "Creating a task via QMS API";&lt;/P&gt;
&lt;P&gt;documentTask.Scope = DocumentTaskScope.General;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Guid triggerID = Guid.NewGuid();&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;// Create a scheduled trigger&lt;/P&gt;
&lt;P&gt;ScheduleTrigger st = new ScheduleTrigger();&lt;/P&gt;
&lt;P&gt;st.ID = triggerID;&lt;/P&gt;
&lt;P&gt;st.Type = TaskTriggerType.OnceTrigger;&lt;/P&gt;
&lt;P&gt;st.Enabled = true;&lt;/P&gt;
&lt;P&gt;st.StartAt = DateTime.Now;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;// Create a list of trigger and add the scheduled trigger&lt;/P&gt;
&lt;P&gt;List&amp;lt;Trigger&amp;gt; List_Trigger = new List&amp;lt;Trigger&amp;gt;();&lt;/P&gt;
&lt;P&gt;List_Trigger.Add(st);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;documentTask.Triggering = new DocumentTask.TaskTriggering();&lt;/P&gt;
&lt;P&gt;documentTask.Triggering.Triggers = List_Trigger;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;documentTask.Triggering.TaskDependencies = new List&amp;lt;TaskInfo&amp;gt;();&lt;/P&gt;
&lt;P&gt;documentTask.Triggering.ExecutionAttempts = 1;&lt;/P&gt;
&lt;P&gt;documentTask.Triggering.ExecutionTimeout = 360;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;// Scope plays an important role&lt;/P&gt;
&lt;P&gt;documentTask.Scope = DocumentTaskScope.General | DocumentTaskScope.Triggering | DocumentTaskScope.Reload;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;//Create task&lt;/P&gt;
&lt;P&gt;apiClient.SaveDocumentTask(documentTask);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;4. see the task 'Partial Reload of Development.qvw' was created, try running it - NOTHING HAPPENS!, how do we know, because we opened the 'Development.qvw' file in the qlikview client and did Settings -&amp;gt; Document Settings -&amp;gt; General tab -&amp;gt; Generate Logfile &amp;amp; Timestamp in Logfile Name, and no log file was created )-:, now lets run the the 'Reload of Development.qvw', we can see a log file was created,&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;also a new file was created in tasks 'Task_6c92c573-a395-47e2-8e75-a15f0d128b46.xml'.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;5. now here is where the magic happens:&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;a. open both tasks xmls in notepad++ (from 'C:\ProgramData\QlikTech\DistributionService\Tasks')&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;b. make sure you opened notepad++ using 'run as administrator'&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;c. now copy all the data from 'Reload of Development'&amp;nbsp; ('Task_39614ba7-0628-4264-ac31-b553ba3a0862.xml' if we open both xmls the names are inside) to the 'Partial Reload of Development.qvw' ('Task_6c92c573-a395-47e2-8e75-a15f0d128b46.xml') and save the file EXCEPT 'DistributeTask' open node, so basically all the lines except the first two.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;d. restart the 'QlikView Distribution Service' from Start -&amp;gt; Administrative Tools -&amp;gt; Services&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;e. now run the the task - &lt;SPAN style="font-weight: bold; color: #545454; font-family: arial, sans-serif; font-size: small; text-align: right;"&gt;VOILÀ&lt;/SPAN&gt; the task is running!, problem is, its doing a full reload )-:&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;f. open the xml again of the 'Partial Reload of Development.qvw' search for 'LoadType' in the 'SourceDocument' node and change it to 'PartialReload', restart the 'QlikView Distribution Service' again, run the task from the qmc.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;g. if you dont want the trigger in the xml you can remove it otherwise the partial task will run with the trigger settings, this is the line:&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;PRE __default_attr="xml" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14447401261075842" jivemacro_uid="_14447401261075842"&gt;
&lt;P&gt;&amp;lt;ScheduleTrigger ID="0afcc688-06c2-4925-93ac-d153a298cb5d" Enabled="True" EnableDateTime="2014-01-01 00:00:00Z" ExpireDateTime="9999-12-31 23:59:59Z" RecurrenceType="RecurrenceDaily" RepeatEvery="1" HourStart="2014-01-01 02:00:00Z" DayStart="0" RepeatMaxCount="0" /&amp;gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;that's it! you have partial reload&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;you might want to delete some tasks, copy the task ID (name of task is inside the file) and run the code:&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;PRE __default_attr="c#" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14447401261017064 jive_text_macro" jivemacro_uid="_14447401261017064"&gt;
&lt;P&gt;IList&amp;lt;TaskInfo&amp;gt; taskList, docTaskList;&lt;/P&gt;
&lt;P&gt;List&amp;lt;string&amp;gt; taskstoremove = new List&amp;lt;string&amp;gt;();&lt;/P&gt;
&lt;P&gt;taskstoremove.Add("6c92c573-a395-47e2-8e75-a15f0d128b46");&lt;/P&gt;
&lt;P&gt;foreach (var item in taskstoremove)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var taskID = new Guid(item);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var task = apiClient.GetTask(taskID);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; apiClient.DeleteTask(taskID, TaskType.DocumentTask);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (System.Exception ex)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; response.Append(ex.Message);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;/PRE&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;you might want to run the task, this is no problem, create any app, console app or .net app what ever you want and run the code:&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;PRE __default_attr="c#" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14447401260993292 jive_text_macro" jivemacro_uid="_14447401260993292"&gt;
&lt;P&gt;apiClient.RunTask(new Guid("6c92c573-a395-47e2-8e75-a15f0d128b46"));&lt;/P&gt;
&lt;/PRE&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;CAUTION! CAUTION! CAUTION!&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;do not delete any of the xml's (from 'C:\ProgramData\QlikTech\DistributionService\Tasks') deleting them without first delete them from code using 'DeleteTask' will crush 'QlikView Distribution Service' on restart and you wont be able to start the service again after stopping it!!!&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;hope this helped!.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;im not sure this is the only solution, we don't have the Publisher licence so there might be other solutions using the publisher.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;im not sure what happens if you delete the original task the 'Reload of Development.qvd' im too lazy to test it&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;P.S.:&lt;BR /&gt;for some reason i just cant get any of the api methods to return all tasks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;iv tried the api apiClient.GetTasks and the apiClient.GetTasksForDocument while looping over all docs, nothing worked.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;maybe it's because we don't have publisher, finally iv found a work around:&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;PRE __default_attr="c#" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14447401260946539" jivemacro_uid="_14447401260946539"&gt;
&lt;P&gt;// Initiate backend client&lt;/P&gt;
&lt;P&gt;IQMS apiClient = new QMSClient();&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;// Get QlikView Server&lt;/P&gt;
&lt;P&gt;ServiceKeyClientMessageInspector.ServiceKey = apiClient.GetTimeLimitedServiceKey();&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;var serviceList = apiClient.GetServices(ServiceTypes.QlikViewServer);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;List&amp;lt;TaskInfo&amp;gt; taskInfoList = new List&amp;lt;TaskInfo&amp;gt;();&lt;/P&gt;
&lt;P&gt;TaskStatusFilter taskStatusFilter = new TaskStatusFilter();&lt;/P&gt;
&lt;P&gt;taskStatusFilter.TaskStatuses = new List&amp;lt;TaskStatusValue&amp;gt;();&lt;/P&gt;
&lt;P&gt;taskStatusFilter.TaskStatuses.Add(TaskStatusValue.Aborting);&lt;/P&gt;
&lt;P&gt;taskStatusFilter.TaskStatuses.Add(TaskStatusValue.Completed);&lt;/P&gt;
&lt;P&gt;taskStatusFilter.TaskStatuses.Add(TaskStatusValue.Failed);&lt;/P&gt;
&lt;P&gt;taskStatusFilter.TaskStatuses.Add(TaskStatusValue.Running);&lt;/P&gt;
&lt;P&gt;taskStatusFilter.TaskStatuses.Add(TaskStatusValue.Waiting);&lt;/P&gt;
&lt;P&gt;taskStatusFilter.TaskStatuses.Add(TaskStatusValue.Warning);&lt;/P&gt;
&lt;P&gt;List&amp;lt;TaskStatus&amp;gt; taskStatuses = apiClient.GetTaskStatuses(taskStatusFilter, TaskStatusScope.Extended); // A service call.&lt;/P&gt;
&lt;P&gt;foreach (var taskStatus in taskStatuses)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; taskInfoList.Add(apiClient.GetTask(taskStatus.TaskID));&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;/PRE&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;from here you can easily run task by name or what ever. (-:&lt;BR /&gt;iv attached the project solution and the xmls.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;a good way to run the code is to create a console application (EXE) and run it with button macro that runs that application, in this example i compiled a small program that runs the partial reload, it searches for task with the name 'partial' on the 'development' document.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE __default_attr="c#" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14447401260882172" jivemacro_uid="_14447401260882172"&gt;
&lt;P&gt;Sub ScriptPartialReload&lt;/P&gt;
&lt;P&gt;&amp;nbsp; set v = ActiveDocument.GetVariable("vLastPartialReloadAttempt")&lt;/P&gt;
&lt;P&gt;&amp;nbsp; v.SetContent now(),true&lt;/P&gt;
&lt;P&gt;&amp;nbsp; rem msgbox("Partial")&lt;/P&gt;
&lt;P&gt;&amp;nbsp; set v = ActiveDocument.GetVariable("vFileName")&lt;/P&gt;
&lt;P&gt;&amp;nbsp; vFile = v.GetContent.String&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Platform = ActiveDocument.Evaluate("ClientPlatform()")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if isnull(Platform) or Len(Platform)=0 then&lt;/P&gt;
&lt;P&gt;&amp;nbsp; ActiveDocument.PartialReload&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Set shell = CreateObject("WScript.Shell")&lt;/P&gt;
&lt;P&gt;&amp;nbsp; shell.Run "C:\QlikViewTasks\qv-user-manager.exe -t partial -d " + vFile&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end if&lt;/P&gt;
&lt;P&gt;End Sub&lt;/P&gt;
&lt;/PRE&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;this will only work if you &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 10pt; line-height: 1.5em;"&gt;enabling the &lt;/SPAN&gt;&lt;SPAN style="line-height: 1.5em; color: #000000; font-size: 11px; font-style: inherit; font-family: inherit; font-weight: inherit;"&gt;&lt;STRONG&gt;Allow macro execution on server&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 10pt; line-height: 1.5em;"&gt; and&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: inherit; font-size: 10pt; line-height: 1.5em; font-style: inherit;"&gt;&lt;STRONG&gt; &lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 11px; font-family: Tahoma; color: #000000;"&gt;Allow unsafe macro execution on server&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 10pt; line-height: 1.5em;"&gt; on your Qlikview Server Managment Console.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Go to System-&amp;gt;Setup-&amp;gt;Qlikview Servers-&amp;gt;Security tab.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;you might also need to enable macros in the document&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Go to Tools -&amp;gt; Edit Module -&amp;gt; Requested Module Security: System Access, Current Local Security: Allow System Access&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;the final result is:&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;IMG __jive_id="74198" alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/101877_Capture.PNG" style="height: 167px; width: 620px;" /&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;adding in the end of the load script this part unable you to create a smart behavior for the reload button&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;PRE __default_attr="c#" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14447401260857394 jive_text_macro" jivemacro_uid="_14447401260857394"&gt;
&lt;P&gt;IF(IsPartialReload()) THEN&lt;/P&gt;
&lt;P&gt;&amp;nbsp; LET vLastPartialReload = Now();&lt;/P&gt;
&lt;P&gt;ELSE&lt;/P&gt;
&lt;P&gt;&amp;nbsp; LET vLastReload = Now();&lt;/P&gt;
&lt;P&gt;ENDIF&lt;/P&gt;
&lt;/PRE&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;in the reload button properties in 'Enable Condition' write&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;PRE __default_attr="c#" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14447401260813541" jivemacro_uid="_14447401260813541"&gt;
&lt;P&gt;=Interval(vLastPartialReload - vLastPartialReloadAttempt, 'ss') &amp;gt; 0&lt;/P&gt;
&lt;/PRE&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;and now the button will be disabled until the end of the reload process.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Please&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;IMG __jive_id="74202" class="jive-image image-2" src="https://community.qlik.com/legacyfs/online/101878_pastedImage_1.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;If you found it helpful (-:.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Dec 2014 09:55:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/How-to-create-a-task-with-PARTIAL-Reload-using-QMS-API/m-p/476754#M1270300</guid>
      <dc:creator>yakir_manor</dc:creator>
      <dc:date>2014-12-25T09:55:57Z</dc:date>
    </item>
  </channel>
</rss>

