WorkflowUnitClusterPk vs WorkflowUnitPk

ssmith-nova
New Contributor III

What is the difference between WorkflowUnitClusterPk vs WorkflowUnitPk?

When would you use one over the other?

 

Thanks,

Scott

2 ACCEPTED SOLUTIONS

franciscoamores
Contributor II

In the Workflow Unit Cluster Pk object you can access:

  • Profile Key 
  • Scenario Key
  • Time Key

The Workflow Unit Pk is the Workflow Unit Cluster Pk + the Workflow Key.

The workflow key identifies the "Workflow Name" so what you se here:

franciscoamores_0-1717057016592.png

All Workflow keys available are in SharedConstants.WorkflowKeys. For example, "Import, Validate and Load" is the Workflow SharedConstants.SimpleDataLoad.

I use any of the two depending on what the method that I want call gets as input parameter. Most of them are usually getting the WFU Cluster PK as that identifies your selection in open place. Indeed, you can create the WF Unit Cluster PK from the WF Unit PK using method CreateWorkflowUnitClusterPk().

HTH.

View solution in original post

RobbSalzmann
Valued Contributor

WorkflowUnitPk can be used as a factory object with error checking to create instances of WorkflowUnitClusterPK:

Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As ExtenderArgs) As Object
	Try
		Dim profileKey As Guid = New Guid(args.NameValuePairs.XFGetValue("ProfileKey"))
		Dim scenarioId As Integer = ConvertHelper.ToInt32(args.NameValuePairs.XFGetValue("ScenarioId"))
		Dim timeId As Integer = ConvertHelper.ToInt32(args.NameValuePairs.XFGetValue("TimeId"))
		Dim wfClusterPK As WorkflowUnitClusterPk
		Dim wfUnitPK As New WorkflowUnitPk(profileKey, scenarioId, timeId)
		
		If wfUnitPK.KeyInitialized Then
			wfClusterPK = wfUnitPK.CreateWorkflowUnitClusterPk()
		Else
			BRApi.ErrorLog.LogError(si, XFErrorLevel.Error, "Workflow could not be intialized")
		End If

		Return Nothing
	Catch ex As Exception
		Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
	End Try
End Function

 

View solution in original post

2 REPLIES 2

franciscoamores
Contributor II

In the Workflow Unit Cluster Pk object you can access:

  • Profile Key 
  • Scenario Key
  • Time Key

The Workflow Unit Pk is the Workflow Unit Cluster Pk + the Workflow Key.

The workflow key identifies the "Workflow Name" so what you se here:

franciscoamores_0-1717057016592.png

All Workflow keys available are in SharedConstants.WorkflowKeys. For example, "Import, Validate and Load" is the Workflow SharedConstants.SimpleDataLoad.

I use any of the two depending on what the method that I want call gets as input parameter. Most of them are usually getting the WFU Cluster PK as that identifies your selection in open place. Indeed, you can create the WF Unit Cluster PK from the WF Unit PK using method CreateWorkflowUnitClusterPk().

HTH.

RobbSalzmann
Valued Contributor

WorkflowUnitPk can be used as a factory object with error checking to create instances of WorkflowUnitClusterPK:

Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As ExtenderArgs) As Object
	Try
		Dim profileKey As Guid = New Guid(args.NameValuePairs.XFGetValue("ProfileKey"))
		Dim scenarioId As Integer = ConvertHelper.ToInt32(args.NameValuePairs.XFGetValue("ScenarioId"))
		Dim timeId As Integer = ConvertHelper.ToInt32(args.NameValuePairs.XFGetValue("TimeId"))
		Dim wfClusterPK As WorkflowUnitClusterPk
		Dim wfUnitPK As New WorkflowUnitPk(profileKey, scenarioId, timeId)
		
		If wfUnitPK.KeyInitialized Then
			wfClusterPK = wfUnitPK.CreateWorkflowUnitClusterPk()
		Else
			BRApi.ErrorLog.LogError(si, XFErrorLevel.Error, "Workflow could not be intialized")
		End If

		Return Nothing
	Catch ex As Exception
		Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
	End Try
End Function