Click or drag to resize
IQMSGetEDXTaskStatus Method
Gets the EDX task status.

Namespace: PIX.Services.V12
Assembly: 
Syntax
EDXStatus GetEDXTaskStatus(
	Guid qdsID,
	Guid executionID
)

Parameters

qdsID
Type: SystemGuid
The QDS ID.
executionID
Type: SystemGuid
The execution instance ID.

Return Value

Type: EDXStatus
The status of a specific execution of the task.
Remarks
Security note Security Note

Requires membership of local group QlikView EDX.

Examples
The following example shows how to trigger a task and then wait until it has finished or a certain amount of time has passed.

The service key injection is assumed to be handled behind the scenes. For an example of how to inject the service key, see Samples.

C#
 using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Threading;
 using QMSAPI;

class Program
{
     static void Main(string[] args)
     {
         try
         {
             // create a QMS API client
             IQMS apiClient = new QMSClient();

             //retrieve a time limited service key
             ServiceKeyClientMessageInspector.ServiceKey = apiClient.GetTimeLimitedServiceKey();

            //Get a Distribution Service.
            ServiceInfo qdsService = apiClient.GetServices(ServiceTypes.QlikViewDistributionService).FirstOrDefault();

            if (qdsService != null)
            {
                //Trigger the task
                TriggerEDXTaskResult result = apiClient.TriggerEDXTask(qdsService.ID, "PauseEDX", "edx", "", new List<string>());

                EDXStatus executionStatus = null;

                //Wait until the task is completed or 60 seconds has passed.
                SpinWait.SpinUntil(() =>
                    {
                        System.Threading.Thread.Sleep(1000);
                        Console.WriteLine("Checking the task...");

                        //Get the current state of the task.
                        executionStatus = apiClient.GetEDXTaskStatus(qdsService.ID, result.ExecId);

                        //Return true if the task has completed.
                        return executionStatus != null && executionStatus.TaskStatus == TaskStatusValue.Completed;
                }, 60 * 1000);

                //Write the result
                if (executionStatus != null)
                    Console.WriteLine(executionStatus.TaskStatus);
                else
                    Console.WriteLine("Failed to get execution status.");

            }
         }
         catch (Exception ex)
         {
             Console.WriteLine("An exception occurred: " + ex.Message);
         }
         // wait for user to press any key
         Console.ReadLine();
     }
}
See Also