'How to create a task with PARTIAL Reload' using QMS API?
Hi Team, GM.
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].
DocumentNode document = apiClient.GetUserDocuments(qds.ID).Where(x => x.Name.Equals("Development.qvw", StringComparison.OrdinalIgnoreCase)).FirstOrDefault(); //Get first source document for this example
DocumentTask documentTask = new DocumentTask();
documentTask.QDSID = qds.ID;
documentTask.Document = document;
documentTask.Reload = new DocumentTask.TaskReload();
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 -> Document Settings -> General tab -> Generate Logfile & 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,
also a new file was created in tasks 'Task_6c92c573-a395-47e2-8e75-a15f0d128b46.xml'.
5. now here is where the magic happens:
a. open both tasks xmls in notepad++ (from 'C:\ProgramData\QlikTech\DistributionService\Tasks')
b. make sure you opened notepad++ using 'run as administrator'
c. now copy all the data from 'Reload of Development' ('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.
d. restart the 'QlikView Distribution Service' from Start -> Administrative Tools -> Services
e. now run the the task - VOILÀ the task is running!, problem is, its doing a full reload )-:
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.
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:
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!!!
hope this helped!.
im not sure this is the only solution, we don't have the Publisher licence so there might be other solutions using the publisher.
im not sure what happens if you delete the original task the 'Reload of Development.qvd' im too lazy to test it
P.S.: for some reason i just cant get any of the api methods to return all tasks,
iv tried the api apiClient.GetTasks and the apiClient.GetTasksForDocument while looping over all docs, nothing worked.
maybe it's because we don't have publisher, finally iv found a work around:
from here you can easily run task by name or what ever. (-: iv attached the project solution and the xmls.
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.
set v = ActiveDocument.GetVariable("vLastPartialReloadAttempt")