Updating Entity Relationship for Percent Ownership
Can any one provide me with a rule snippet for updating Entity Percent Ownership. I have tried a few things using the SaveRelationshipInfo but it is not working.
Can any one provide me with a rule snippet for updating Entity Percent Ownership. I have tried a few things using the SaveRelationshipInfo but it is not working.
This should work, but please make sure you understand what it does before dropping it into production code. You might want to surround the SaveRelationshipInfo call with a try/catch to be on the safe side. As for anything posted on these forums, we make no guarantees in terms of support, you're on your own.
' coordinates
Dim myScenarioID As Integer = brapi.Finance.Members.GetMemberId(si, DimType.Scenario.Id, "Actual")
Dim myScenarioType As ScenarioType = BRApi.Finance.Scenario.GetScenarioType(si, myScenarioID)
Dim myTimeID As Integer = BRApi.Finance.Time.GetIdFromName(si, "2020M3")
Dim myEntityID As Integer = BRApi.Finance.Members.GetMemberId(si, DimType.Entity.Id, "Frankfurt")
Dim myParentID As Integer = BRApi.Finance.Members.GetMemberId(si, DimType.Entity.Id, "Europe")
' fetch relationship.
Dim relationship As Relationship = BRApi.Finance.members.ReadRelationshipNoCache(si, _
DimType.Entity.Id, myEntityID, myParentID)
' create new properties
' this should leave other properties alone and just merge with existing values, but check; worst case, repro other props before saving
Dim newProperties As New VaryingMemberProperties( DimType.Entity.Id, myEntityID, myParentID )
newProperties.GetEntityRelationshipProperties().PercentOwnership.SetStoredValue( _
myScenarioType.Id, myTimeID, 40.0)
' we only save properties in this case
brapi.Finance.MemberAdmin.SaveRelationshipInfo(si, _
False, relationship, _
True, newProperties, _
Nothing)
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.