TriggerEDXTask Method
Overloads
TriggerEDXTask(Guid, String, String, String, List<String>) |
Triggers an EDX task. |
TriggerEDXTask(Guid, String, String, String, List<String>)
Triggers an EDX task.
Declaration
TriggerEDXTaskResult TriggerEDXTask(Guid qdsID, string taskNameOrID, string password, string variableName, List<string> variableValues)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | qdsID |
The QDS ID. |
System.String | taskNameOrID |
The task name or ID. |
System.String | password |
The password. |
System.String | variableName |
Name of the variable. |
System.Collections.Generic.List<System.String> | variableValues |
The variable values. |
Returns
Type | Description |
---|---|
TriggerEDXTaskResult |
The result of the trigger. This includes an execution ID which is used to check the status of the edx task. This allows for multiple instances of the same task to be triggered, while still being able to check the state of a specific execution. |
Remarks
In order to be accessible through this interface an EDX task has to be configured first.
This can be considered an alternative to the RunTask(Guid) service. The taskNameOrID
parameter can
accept either a complete, correctly capitalized, unique task name or an task ID.
security
Requires membership of local group QlikView EDX.
If the task name matches multiple tasks, no task will be started abd the EDXTaskStartResult will be set to CouldNotDetermineTaskByName.
If the provided password is wrong, a new log entry will be created in the event log with information about the name of the task and the id of the calling user.
If the task does exist, the result will have its EDXTaskStartResult field set to TaskNotFound.
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.
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
Did this page help you?
If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!