Help Needed Moving a Scenario Member
I have a need to move a scenario from under a parent to under Root. Take the example below. I want to move "Forecast" under Root before "ForecastArchive". To do that, my plan was to add a relationship for "Forecast" under Root, and then removing the relationship of "Forecast" under "BudgetScenarios". I am assuming there is not a more direct way to move a member in one step, but would love to be wrong.
I am having issues with the first step trying to add "Forecast" before "ForecastArchive" under Root. Below is my code. Does anyone know what I may be doing wrong? Bonus points if you also know how to remove the "Forecast" relationship with the parent "BudgetScenarios" to complete the move. I am sure it's something simple but can't figure it out. When I run this as an extensibility rule, it completes without error but nothing changes in the sceanrio dimension.
Dim ForecastArchive_Mem As Member = BRApi.Finance.Members.GetMember(si, DimTypeId.Scenario, "ForecastArchive")
Dim Forecast_Mem As Member = BRApi.Finance.Members.GetMember(si, DimTypeId.Scenario, "Forecast")
Dim scenarioDimPk As DimPk = BRApi.Finance.Dim.GetDimPk(si, "TopScenarioDim")
Dim ForecastArchive_ParMem As Member = BRApi.Finance.Members.GetParents(si, scenarioDimPk, ForecastArchive_Mem.MemberId, True).Item(0)
Dim newRootMemRelPos As New RelationshipPositionOptions
newRootMemRelPos.SiblingId = ForecastArchive_Mem.MemberId
newRootMemRelPos.MovementType = RelationshipMovementType.InsertBeforeSibling
Dim newRootMemRelInfo As New RelationshipInfo
Dim relationship As New Relationship
Dim relationshipPK As New RelationshipPk
relationshipPK.ParentId = ForecastArchive_ParMem.MemberId
relationshipPK.ChildId = Forecast_Mem.MemberId
relationship.RelationshipPk = relationshipPK
newRootMemRelInfo.Relationship = relationship
BRApi.Finance.MemberAdmin.SaveRelationshipInfo(si, newRootMemRelInfo, newRootMemRelPos)