cancel
Showing results for 
Search instead for 
Did you mean: 

Adding member relationship via Extender Rule

NidhiMangtani
Contributor II

Hello,

Please share a reference for adding a relationship between dimension members via Extender rule. I am trying to add new members via Extender rule, the member gets added as an Orphan. 

I have tried using SaveRelationshipInfo by passing Parent Member ID, Sibling ID and the new member ID, The IDs being passed are correct, but still the new member gets added as an Orphan. 

Current code which I am trying for adding relationship:

 

Public Sub AddRelationForNewCurrentRate(ByVal si As SessionInfo, ByVal api As Object, ByVal objPriorMemberInfo As MemberInfo)

Try
Dim objUtil As New OneStream.BusinessRule.Extender.EQUIP_Utility_Helper.MainClass(si)

Dim sParentMemberID As String = String.Empty
Dim sNewMemberID As String = String.Empty

'Get Parent
Dim objParentMemberInfo As List(Of MemberInfo) = BRApi.Finance.Metadata.GetMembersUsingFilter(si, "RevSummaryAccounts", "A#[" & Sibling & "].Parents", True)
If Not IsNothing(objParentMemberInfo) AndAlso objParentMemberInfo.Count > 0 Then
sParentMemberID = objParentMemberInfo(0).Member.MemberId
End If

'Get New Member
Dim objNewMemberInfo As List(Of MemberInfo) = BRApi.Finance.Metadata.GetMembersUsingFilter(si, "RevSummaryAccounts", "A#[" & NewMember & "]", True)
If Not IsNothing(objNewMemberInfo) AndAlso objNewMemberInfo.Count > 0 Then
sNewMemberID = objNewMemberInfo(0).Member.MemberId
BRapi.ErrorLog.LogMessage(si, "Child ID: " & sNewMemberID)
End If

Dim relationshipInfo As New RelationshipInfo
Dim relationship As New Relationship
Dim relationshipPK As New RelationshipPk
relationshipPK.ParentId = sParentMemberID
relationshipPK.ChildId = sNewMemberID
relationship.RelationshipPk = relationshipPK
relationshipInfo.Relationship = relationship

Dim relationshipPositionOptions As New RelationshipPositionOptions
relationshipPositionOptions.SiblingId = objPriorMemberInfo.Member.MemberId

' BRapi.ErrorLog.LogMessage(si, "Child ID: " & relationshipInfo.Relationship.RelationshipPk.ChildId)
BRapi.ErrorLog.LogMessage(si, "Parent ID: " & sParentMemberID)
BRapi.ErrorLog.LogMessage(si, "Sibling ID: " & objPriorMemberInfo.Member.MemberId)

BRApi.Finance.MemberAdmin.SaveRelationshipInfo(si, relationshipInfo, relationshipPositionOptions)

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

End Sub

Thanks,
Bharti Paryani
1 ACCEPTED SOLUTION

NidhiMangtani
Contributor II

Additionally passed DimID, DimTypeID and UD Aggregation weight and it worked as expected. No action needed on this further.

Thanks,
Bharti Paryani

View solution in original post

1 REPLY 1

NidhiMangtani
Contributor II

Additionally passed DimID, DimTypeID and UD Aggregation weight and it worked as expected. No action needed on this further.

Thanks,
Bharti Paryani