Skip to main content
Member
May 30, 2024 12:21 AM UTC
Solved

WorkflowUnitClusterPk vs WorkflowUnitPk

What is the difference between WorkflowUnitClusterPk vs WorkflowUnitPk?

When would you use one over the other?

 

Thanks,

Scott

Member
May 30, 2024 8:20 AM UTC

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.

2 replies

Member
May 30, 2024 8:20 AM UTC

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
Employee - Advisor
Employee - Advisor
May 30, 2024 3:20 PM UTC

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