| Author | 
		  Message
		 | 
		
		  | vedbhat | 
		  
		    
			  
				 Posted: Sun Mar 24, 2002 5:12 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Disciple
 
 Joined: 19 Mar 2002 Posts: 186 Location: Singapore 
  | 
		  
		    
			  
				Hi,
 
 
Is it possible to retrieve the details of completed activities without launching Monitor window, when the process is still running.
 
 
Thanks in Advance 
 
 
Regards 
 
Ved
 
 | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | JImmy | 
		  
		    
			  
				 Posted: Sun Mar 24, 2002 9:44 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 23 Feb 2002 Posts: 59 Location: Shanghai, China 
  | 
		  
		    
			  
				yes you can, there is a piece of code to show you how to achieve this:
 
when you logon to MQWF, try
 
 
Integer myint = new Integer(40);
 
// First retrieve the instances
 
ProcessInstance[] insts = service.queryProcessInstances("NAME LIKE '*'", "NAME", myint);
 
System.out.println("service.queryWorkItems successfully!");
 
 
// Print out the instance names
 
System.out.println("We have " + insts.length + " instances in runtime:");
 
for (int i = 0; i < insts.length; i++)
 
{
 
	System.out.println("Instance #" + (i+1) + ": " + insts[i].name());
 
	InstanceMonitor monitor = insts[i].obtainProcessMonitor(false); // Notice here,  
 
	ActivityInstance[] acts = monitor.activityInstances();
 
	System.out.println("	we have " + acts.length + " activities in the instance:");
 
	for (int j = 0; j < acts.length; j++) {
 
		String actName = acts[j].name();
 
		String[] persons = acts[j].staff();
 
		String stat = "" + acts[j].state().value();
 
		System.out.println("		Activity #" + j + ": " + actName);
 
		System.out.println("			Status: " + stat);
 
		System.out.println("			The following persons in the staff: ");
 
		for (int k = 0; k < persons.length; k++) {
 
			System.out.println("				" + persons[k]);
 
		}
 
	}
 
	System.out.println();
 
}
 
 
Hope that can help you.
 
 
[ This Message was edited by: JImmy on 2002-03-24 21:44 ]
 
 
[ This Message was edited by: JImmy on 2002-03-24 21:45 ]
 
 
[ This Message was edited by: JImmy on 2002-03-24 21:47 ] | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | vedbhat | 
		  
		    
			  
				 Posted: Sun Mar 24, 2002 9:46 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Disciple
 
 Joined: 19 Mar 2002 Posts: 186 Location: Singapore 
  | 
		  
		    
			  
				Hi Jimmy,
 
 
Thanks and Will try this one. Hope really it works.
 
 
Regards
 
Ved | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | jmac | 
		  
		    
			  
				 Posted: Mon Mar 25, 2002 7:39 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Knight
 
 Joined: 27 Jun 2001 Posts: 3081 Location: EmeriCon, LLC 
  | 
		  
		    
			  
				The monitor api will give you what you are looking for, what the above code shows is only for Program Activities.  For Process or Block Activities you will need to recurse thru the logic to access the contained activities.
 
 
 _________________ John McDonald
 
RETIRED | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | vedbhat | 
		  
		    
			  
				 Posted: Mon Mar 25, 2002 5:10 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Disciple
 
 Joined: 19 Mar 2002 Posts: 186 Location: Singapore 
  | 
		  
		    
			  
				Hi John,
 
 
Thanks for the reply. I will try to do as you said.
 
 
Regards
 
Ved | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | vedbhat | 
		  
		    
			  
				 Posted: Tue Mar 26, 2002 5:17 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Disciple
 
 Joined: 19 Mar 2002 Posts: 186 Location: Singapore 
  | 
		  
		    
			  
				Hi John/Jimmy,
 
 
I have tried to retrieve the details for program activities but ActivityInstanceArray and ControlConnectorArray size is always returned as zero. Can you let me know whether I have overlooked something or it is not possible in Visual Basic. Below is the code that I used for this purpose.
 
 
Waiting for your reply.
 
 
Regards
 
Ved
 
 
Code
 
----
 
 
    Dim eService As ExecutionService
 
    Dim pilArray As ProcessInstanceListArray
 
    Dim pil As ProcessInstanceList
 
    Dim pi As ProcessInstance
 
    Dim Rc, pilSize, piSize, Retcode As Long
 
    Dim aiSize, ccSize As Long
 
    Dim prcMon As InstanceMonitor
 
    Dim aiArray As ActivityInstanceArray
 
    Dim ccArray As ControlConnectorArray
 
    Dim cci As ControlConnectorInstance
 
    Dim ai As ActivityInstance
 
        
 
    Rc = eService.QueryProcessInstanceLists
 
    pilSize = eService.ProcessInstanceListArray.GetSize
 
    MsgBox "No of Process Instance Lists: " & pilSize
 
    If (pilSize > 0) Then
 
        Set pil = eService.ProcessInstanceListArray.GetAt(0)
 
        MsgBox "Name of Process Instance List : " & pil.Name
 
        
 
        Rc = pil.QueryProcessInstances
 
        piSize = pil.GetSize
 
        MsgBox "Process instances running: " & piSize
 
        If (piSize > 0) Then
 
            Set pi = pil.GetAt(0)
 
            Set prcMon = pi.ObtainMonitor(Retcode, True)
 
            If (Retcode = FMC_OK) Then
 
            	MsgBox "Process Instance Name : " & pi.Name
 
                MsgBox "Process Instance Description : " & pi.Description
 
                    
 
                Set aiArray = prcMon.ActivityInstanceArray
 
                Set ccArray = prcMon.ControlConnectorArray
 
                aiSize = aiArray.GetSize
 
                ccSize = ccArray.GetSize
 
                    
 
                MsgBox "Activity Instance Size : " & aiSize
 
                MsgBox "Control Connectors Size: " & ccSize
 
                    
 
            Else
 
            	MsgBox "Monitor obtained with errors"
 
            End If
 
        Else
 
            MsgBox "No Process Instance."
 
        End If
 
    Else
 
        MsgBox "No Process Instance List."
 
    End If
 
 
 
 
 | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | jmac | 
		  
		    
			  
				 Posted: Tue Mar 26, 2002 5:42 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Knight
 
 Joined: 27 Jun 2001 Posts: 3081 Location: EmeriCon, LLC 
  | 
		  
		    
			  
				I've not done this type of processing with VB, but I bet you need to use the ControlConnectorInstances and ActivityInstances as follows:
 
 
prcMon.ActivityInstances
 
Set aiArray = prcMon.ActivityInstanceArray 
 
prcMon.ControlConnectorInstances
 
Set ccArray = prcMon.ControlConnectorArray 
 
aiSize = aiArray.GetSize 
 
ccSize = ccArray.GetSize 
 
 
I don't begin to understand this VB api, but based on other objects I've had trouble with I bet this will solve the problem
 
 
 
_________________
 
John McDonald
 
SYSCOM Inc.
 
IBM Certified Solutions Expert - 
 
            MQSeries Workflow
 
 
[ This Message was edited by: jmac on 2002-03-26 17:44 ] | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | vedbhat | 
		  
		    
			  
				 Posted: Tue Mar 26, 2002 5:50 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Disciple
 
 Joined: 19 Mar 2002 Posts: 186 Location: Singapore 
  | 
		  
		    
			  
				Hi John,
 
 
I have tried as you mentioned and it works fine.
 
 
Thanks and Regards
 
Ved | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | vedbhat | 
		  
		    
			  
				 Posted: Mon Apr 01, 2002 1:39 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Disciple
 
 Joined: 19 Mar 2002 Posts: 186 Location: Singapore 
  | 
		  
		    
			  
				Hi,
 
 
I was able to retrieve most of the details except for the values of date/time fields. From an Activity Instance, If I would like to retrieve the StartTime/ Endtime/Last Modification, how could I retrieve the same. 
 
 
Regards
 
Ved | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | JImmy | 
		  
		    
			  
				 Posted: Tue Apr 02, 2002 2:07 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 23 Feb 2002 Posts: 59 Location: Shanghai, China 
  | 
		  
		    
			  
				| If you just want to retrieve start time, end time, and last modification, I think all of them are described in API document. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | vedbhat | 
		  
		    
			  
				 Posted: Tue Apr 02, 2002 6:30 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Disciple
 
 Joined: 19 Mar 2002 Posts: 186 Location: Singapore 
  | 
		  
		    
			  
				Hi,
 
 
I had tried as mentioned in the programming guide but couldn't get it working. Did anybody tried it before and got it working. If so, pls let me know.
 
 
From what I understood, If one have access to Activity Instance, he/she should be able to retrieve the EndTime/Start Time/Last modification time etc etc for an activity. 
 
 
I have access to ActivityInstance and I can retrieve all the other parameters except the DateTime fields. Below is the segment of code according to the API document.
 
 
Code
 
--------------------------------
 
Dim lmTime as DateAndTime
 
Dim ai as ActivityInstance
 
 
.......
 
ai.LastModifiedTime(lmTime)
 
 
--------------------------------
 
Thanks in Advance 
 
 
Regards,
 
Ved
 
 
 | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | jmac | 
		  
		    
			  
				 Posted: Wed Apr 03, 2002 5:47 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Knight
 
 Joined: 27 Jun 2001 Posts: 3081 Location: EmeriCon, LLC 
  | 
		  
		    
			  
				Is it possible that these times are not avaialable based on the state of the activity instance?
 
 _________________ John McDonald
 
RETIRED | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | vedbhat | 
		  
		    
			  
				 Posted: Wed Apr 03, 2002 5:26 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Disciple
 
 Joined: 19 Mar 2002 Posts: 186 Location: Singapore 
  | 
		  
		    
			  
				Hi John,
 
 
I guess for the completed activities, I think one should be able to retrieve these values because if one opens the monitor window for a completed activity, he/she could see all these values in the properties. Also API's are provided for retrieving these values. I think either I have done something wrong or this could be a bug. Pls let me know your view on this.
 
 
Pls let me know if I am wrong. Is there any other way to get these details other than by fetching the details from Audit trail table.
 
 
Thanks and Regards
 
Ved
 
 | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |