Attributes in stage

joakimo
New Contributor

I have activated attributs in my connector and tied them to columns. However, they do not appear in my stage and my vStageSourceAndTargetDataWithAttributes is empty. Is there any additional setting that should be activated in order to get the attributes active in stageScreenshot 2024-03-18 at 09.31.01.png?Screenshot 2024-03-15 at 14.27.25.pngScreenshot 2024-03-18 at 09.28.39.pngScreenshot 2024-03-18 at 09.29.08.png

6 REPLIES 6

JoakimK
New Contributor III

I can see in your last screenshot you are at the "Load to Cube" screen. This screen will not show your attributes, you will need to go to the "Import" screen to see them.

Thanks for reply - however, no attributes thereScreenshot 2024-03-18 at 10.09.58.png

JoakimK
New Contributor III

Are you in the correct Cube/ScenarioType where you enabled the Attributes? Because as soon as those fields are enabled, you should see them in the stage table, whether they are empty or not.

joakimo
New Contributor

Thanks, yes it is the correct WF profile, scenario type and cube.

In the TLP_ThingPlanningData Connector, here is how I have added/referred to the attributes (however, they seem to appear/reference correct in the Data Source Connector):

Imports System

#Region "Connection and Field List Methods"
Private Function GetCurrentAppConnectionString(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Transformer, ByVal args As ConnectorArgs) As String
	Try
		'Get the connection string for the current application
		Dim appCon As String = String.Empty
		Using dbConnApp As DbConnInfo = BRApi.Database.CreateApplicationDbConnInfo(si)
			appcon = dbConnApp.ConnectionString
			EndUsing
			Return appCon
		  Catch ex As Exception
		Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
	End Try
End Function

Private Function GetFieldListSQL(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Transformer, ByVal args As ConnectorArgs) As String
	Try
		'Get the SQL string for the valid fields in the Plan table
		Dim sql As New Text.StringBuilder
		sql.Append("Select Top 1 WFProfileName, WFScenarioName, WFTimeName, Period, Entity, ActivityType, ImpactType, Account, Flow, IC, UD1, UD2, UD3, UD4, UD5, UD6, UD7, UD8, (SUBSTRING(RegisterID, CHARINDEX('/', RegisterID) + 1, CHARINDEX('/', RegisterID, CHARINDEX('/', RegisterID) + 1) - CHARINDEX('/', RegisterID) - 1)) as WBS, Annot2 as Controller, NCode6 as PlanRevenue, Amount As Amt From XFW_TLP_Plan")
		Return sql.ToString
	Catch ex As Exception
		Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
	End Try
End Function

#End Region
'......................

 # Region "Source Data Methods"  Private Function GetDataSelectSQL(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Transformer, ByVal args As ConnectorArgs) As String
	Try
		'Retrieve the Thing Plan scenario and time to load from stored Settings
		Dim tlpScenario As String = BRApi.Dashboards.Parameters.GetLiteralParameterValue(si, False, "StoredPlanConnectorScenario_TLPT")
		Dim tlpTime As String = BRApi.Dashboards.Parameters.GetLiteralParameterValue(si, False, "StoredPlanConnectorTime_TLPT")
		'Replace WF value with actual workflow scenario and time
		If tlpScenario.XFEqualsIgnoreCase("WF") Then tlpScenario = ScenarioDimHelper.GetNameFromId(si, api.WorkflowUnitPk.ScenarioKey)
		If tlpTime.XFEqualsIgnoreCase("WF") Then tlpTime = BRApi.Finance.Time.GetNameFromId(si, api.WorkflowUnitPk.TimeKey)
		'Execute a summary query against the Plan Table
		Dim sql As New Text.StringBuilder
		sql.Append("Select WFProfileName, WFScenarioName, WFTimeName, Period, Entity, ActivityType, ImpactType, Account, Flow, IC, UD1, UD2, UD3, UD4, UD5, UD6, UD7, UD8, (SUBSTRING(RegisterID, CHARINDEX('/', RegisterID) + 1, CHARINDEX('/', RegisterID, CHARINDEX('/', RegisterID) + 1) - CHARINDEX('/', RegisterID) - 1)) as WBS, Annot2 as Controller, NCode6 as PlanRevenue, Sum(Amount) As Amt ")
		sql.Append("From XFW_TLP_Plan ")
		sql.Append("Where ")
		sql.Append("(WFScenarioName = '" & SqlStringHelper.EscapeSqlString(tlpScenario) & "') ")
		sql.Append("And (WFTimeName = '" & SqlStringHelper.EscapeSqlString(tlpTime) & "') ")
		sql.Append(Me.GetWFProfileCriteria(si, api))
		'sql.Append("And (WFProfileName Like '" & SqlStringHelper.EscapeSqlString(api.WorkflowProfile.Name.Split(".")(0)) & "%') ")
		'sql.Append("Group By Status, WFProfileName, WFScenarioName, WFTimeName, Period, Entity, ActivityType, ImpactType, Account, Flow, IC, UD1, UD2, UD3, UD4, UD5, UD6, UD7, UD8 ")
		sql.Append("Group By WFProfileName, WFScenarioName, WFTimeName, Period, Entity, ActivityType, ImpactType, Account, Flow, IC, UD1, UD2, UD3, UD4, UD5, UD6, UD7, UD8,(SUBSTRING(RegisterID, CHARINDEX('/', RegisterID) + 1, CHARINDEX('/', RegisterID, CHARINDEX('/', RegisterID) + 1) - CHARINDEX('/', RegisterID) - 1)), Annot2, NCode6")
		Return sql.ToString
	Catch ex As Exception
		Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
	End Try
End Function

Private Sub ValidateNoImportFromCentralRegisterProfile(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Transformer, ByVal args As ConnectorArgs)
	Try
		'Retrieve the name of the Workflow profile used for CENTRAL REGISTER MGMT
		Dim registerProfile As String = BRApi.Dashboards.Parameters.GetLiteralParameterValue(si, False, "StoredPlanRegisterProfile_TLPT")
		'Get the stored WFProfile Criteria Value so that we can determine how the Workflow profile criteria is derived
		Dim loadingProfile As String = String.Empty
		Dim wfProfileCriteria As Integer = CType(BRApi.Dashboards.Parameters.GetLiteralParameterValue(si, False, "StoredPlanConnectorProfile_TLPT"), Integer)
		Dim wfProfileCriteriaType As WFProfileCriteriaTypes = CType(wfProfileCriteria, WFProfileCriteriaTypes)
		Select Case wfProfileCriteriaType
			Case Is = wfProfileCriteriaType.CentralImport
				loadingProfile = api.WorkflowProfile.Name
			Case Is = wfProfileCriteriaType.SameProfile
				loadingProfile = api.WorkflowProfile.Name
			Case Is = wfProfileCriteriaType.ProfileText1Map
				loadingProfile = api.WorkflowProfile.GetAttributeValue(api.ScenarioTypeID, SharedConstants.WorkflowProfileAttributeIndexes.Text1)
				EndSelect
				'Make sure that the user is not trying to load data from the PlanRegisterProfile (Central Register Management Profile)
				If registerProfile.XFEqualsIgnoreCase(loadingProfile) Then
					'Throw, Not allowed to load cube from the central register management profile
					Throw New Exception("Thing Planning: Cannot load data into cube from the Central Register Mangement Workflow Profile '" & registerProfile & "'.")
				End If

		  Catch ex As Exception
		Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
	End Try
End Sub
#End Region

 

JoakimK
New Contributor III

This is getting close to be better off as a support ticket/Remote consulting item, but one thing I would advice you to test, is to add a logging function just before the "return sql.ToString" that reads something like BRApi.ErrorLog.LogMessage(si, sql.ToString) to capture the SQL query you are running, then copy/paste that into a Dashboard Data Adapter to make sure you are getting info into that WBS field.

But also, as I mentioned, when an attribute field is activated, you should see that field in the Import step of the Workflow even before attempting to put data into it, as an empty field, and you dont even have the column there so I am assuming something is not setup correctly.

I've reformatted your code for you - please use the procedure mentioned in this thread to post code next time. Well-formatted code is more likely to attract responses - I personally wouldn't review some 100 lines without it.