Are user-driven partial reloads allowed from QV Server?
I have allowed macro executions on server (also unsafe macro executions), allow full and partial reloads in the document security tab. I see that there is no action associated with full or partial reloads, so I wrote a macro that calls Partial Reload like this:
Sub PartialReload ActiveDocument.PartialReload End Sub
This procedure works as expected in QV Desktop, but it does not work in QV Server running zero-footprint ajax. I have also tried the DoReload and ReloadEx macro calls without success.
Are partial reloads not working in QV Server? Does anyone have an example of a partial reload working? I can create a sample .qvw document illustrating this problem if needed.
This partial reload is needed because we have an application that is extremely complex using aggr() functions and we need to pre-process many operations after changing some settings. Our end-users would not be happy sitting for 60-240 seconds for a simple selection change, whereas pre-processing some calculations brings the application into the usable range of 3-10 seconds. The data sets are currently not huge (~.5M records), and we need a scalable solution for when we use millions of records.
I don't think any reload API call will work in the Server environment. I believe the way this is usually done is make an http EDX request to Publisher to run the reload task. In the reload task Partial reload can be specified. The http url can be the launch action of a button.
My solution was to create an "EDX" event-driven task (as Rob suggested). Our license is an OEM version, so I am not sure if EDX is supported in the small business edition.
My QlikView document has a button that calls a macro function. This macro function sends an HTTP GET request (using WinHttp.WinHttpRequest.5.1 object) to a web page on the same server. The business logic on the web page requests a session key from the QV server, and then sends an EDX request to the server with arguments for the task name, the session key, and the password stored with the EDX.
The only thing missing from this process is a progress bar or method to "push" the just-reloaded data to the Ajax client. Our instructions tell the user to click around after a minute until the new data appears. If you have a better solution (or a progress bar!), I'd be grateful. Note that I cannot ge the "Allow dynamic data update" checkbox to stay on in the QV server setup page, so I suspect my own license is insufficient.
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")