Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am just starting to play around with the QMC API using C# and have successfully ran a few test scripts. I am looking to create a simple application that can list the current tasks, what category it falls into, and what jobs are scheduled to run after this task finishes. Something like below. I am able to write a simple console application that lists all of the tasks, and seperately lists all of the categories, but linking them together I have not figured out. And then trying to tie that into which jobs trigger other jobs is seeming over my head. I am very new at this but would like to learn. Any help is appreciated.
Category: Admin
Task 1: ABC Reload
Task 1.1: ABC Publish
Task 1.2 DEF Reload
Task 1.3 DEF Publish
Category: Adhoc
Task 2: GHI Reload
Task 2.1 GHI Publish
Category: Default
Task 3 JKL Reload
Task 3.1 JKL Publish
Hi Brian,
Have you checked out the Power Tools - QMS API Tool? Perhaps it can help you list and test all available commands. Power Tools 1.2 for QlikView
Regards,
Erik
Thanks Erik,
This is helpful, and I was able to get a bit further, but still haven't quite figured out how to get the tasks exactly as I am looking for. I can see what task triggers the next task, but haven't yet figured out how to link them all together in a chain or treeview.
Hi Brian,
I believe this comes down to how you program your application. In general you should be able to pull out all the information from the QMC with the API, then it is a matter of mapping it together.
Regards,
Erik
I am getting closer, but am stuck and am hoping someone can point me in the right direction. I have created a function that is getting the category and the first level tasks and it is working fine. What I am having a problem with is getting the next level, and continuing down to the last task. I am new at programming in c#, so any help is appreciated.
Here is my function. I apologize the formatting might not come through as nice with the copy paste.
public void Tree_View(QMSClient Client)
{
List<string> CategoriesList = new List<string>();
List<string> TaskList = new List<string>();
List<string> FirstTask = new List<string>();
List<string> NextTask = new List<string>();
//Get All Categories
IList<Category> categories = Client.GetCategories(CategoriesScope.Used);
//Get qdsID
ServiceInfo[] myServices = Client.GetServices(ServiceTypes.All);
Guid qdsGuid = myServices[1].ID;
Guid qdsId = new Guid(qdsGuid.ToString());
//End qdsID
//Create TreeView
TreeNode ParentNode = new TreeNode();
ParentNode.Text = "Parent";
ParentNode.Name = "Parent";
Tasks_TV.Nodes.Add(ParentNode);
//Finding All Categories
IList<TaskInfo> taskInfoList = Client.GetTasks(qdsId);
for (int x = 0; x < taskInfoList.Count; x++)
{
Guid taskId = new Guid(taskInfoList
QMSAPIService.TaskStatus taskStatus = Client.GetTaskStatus(taskId, TaskStatusScope.All);
CategoriesList.Add(taskStatus.Extended.Category);
TaskList.Add(taskStatus.Extended.Category + "." + taskStatus.General.TaskName);
if (!taskStatus.Extended.StartTime.Contains("\""))
{
FirstTask.Add(taskStatus.General.TaskName);
}
else
{
String NextTaskStr = taskStatus.Extended.StartTime.Substring(taskStatus.Extended.StartTime.IndexOf("\"") + 1).Trim();
NextTaskStr = taskStatus.General.TaskName.Trim();
NextTask.Add(NextTaskStr);
}
}
//Removing Duplicate Categories & Tasks
var UniqueCategories = new HashSet<string>(CategoriesList);
var UniqueTasks = new HashSet<string>(TaskList);
//Looping to Add TreeView
foreach (var value in UniqueTasks)
{
String CatSubStr = value.Substring(0, value.IndexOf(".")).Trim();
//If Category Doesn't Exist Add It As The First Child Node
if (!ParentNode.Nodes.ContainsKey(CatSubStr))
{
TreeNode ChildNode1 = new TreeNode();
ChildNode1.Name = CatSubStr;
ChildNode1.Text = CatSubStr;
ParentNode.Nodes.Add(ChildNode1);
foreach (var value2 in UniqueTasks)
{
String CatSubStr2 = value2.Substring(0, value2.IndexOf(".")).Trim();
String TaskSubStr2 = value2.Substring(value2.IndexOf(".") + 1).Trim();
//If The Task Hasn't Been Added, And Is In This Category, Add It
if (!ChildNode1.Nodes.ContainsKey(TaskSubStr2) & CatSubStr == CatSubStr2)
{
TreeNode NextChildNode1 = new TreeNode();
TreeNode NextSubChildNode = new TreeNode();
if (FirstTask.Contains(TaskSubStr2))
{
NextChildNode1.Name = TaskSubStr2;
NextChildNode1.Text = TaskSubStr2;
ChildNode1.Nodes.Add(NextChildNode1);
}
else
{
}
}
}
}
}
}
Hi Brian,
I'm afraid this is a bit outside my expertise, but hopefully you will get more responses if you move this thread to "Integration" rather than Management. Different forums have different readers.
Good luck.
Erik
Thanks Erik,
I have updated this post to Integration in hopes of someone being able to help.