Quantcast
Channel: Forum Posts
Viewing all articles
Browse latest Browse all 614

Add a counter to your workflow

$
0
0

Hi, I developed this function for my workflow I think you guys may also find this useful.
 
Code :

Sub set_counter_OnLoad
	If (LastJobOfBatch()) Then
		EKOManager.StatusMessage("I am the last one!!!")	
	Else
		EKOManager.StatusMessage("Not yet... Wait for it...")
	End If
End Sub

Function LastJobOfBatch()
	job_count = EKOManager.KnowlegeObjectCount
	cur_index = GetJobIndex()
	If cur_index < job_count Then
		LastJobOfBatch = false
	ElseIf cur_index = job_count Then
		LastJobOfBatch = true
	Else
		LastJobOfBatch = false
	End If
	
End Function

Function GetJobIndex()
	Set PTopic = EKOManager.GetPersistenceTopic()
	If Not (PTopic is Nothing) Then
		Set index = PTopic.GetEntry("index",0)
		If index is Nothing Then
			Call PTopic.AddEntry("index")
			Set new_index = PTopic.GetEntry("index",0)
			new_index.Value = 1
			GetJobIndex = new_index.Value
		Else	
			curIndex = index.Value
			index.Value = curIndex + 1
			GetJobIndex = index.Value
		End If
	Else
		GetJobIndex = -1
	End If
	
End Function

By using this function you will be able to track the process of your work flow and know which file is the last one of a batch. 


Viewing all articles
Browse latest Browse all 614

Trending Articles