WernerN,
Does your code already create the member and the only issue is with the properties? If the issue is with properties, then which property?
Keep in mind that creating a member requires two main steps:
- Create the member
- Add Relationship
For the first step, if you don't have the code, here's something you can try. Of course, you'll need to create the variables I'm using in this code, but you get the idea of how to do so:
'Update Dim Name accordingly
Dim objDim As OneStream.Shared.Wcf.Dim = BRApi.Finance.Dim.GetDim(si, DimensionName)
'Create New Member
Dim objMember As New Member(objMemberPk, ChildName, ChildDesc, objDim.DimPk.DimId)
'Create VaryingMemberProperties object
Dim objProperties As New VaryingMemberProperties(objMemberPk.DimTypeId, objMemberPk.MemberId, DimConstants.Unknown)
'Create new member info object for new member
Dim objMemberInfo As New MemberInfo(objMember, objProperties, Nothing, objDim, DimConstants.Unknown)
'Modify some member properties.
Dim newmemberProperties As ScenarioVMProperties = objMemberInfo.GetScenarioProperties()
'Save the member and its properties.
Dim isNew As TriStateBool = TriStateBool.TrueValue
BRApi.Finance.MemberAdmin.SaveMemberInfo(si, objMemberInfo, True, True, False, isNew)
Please, note that one thing that will vary depending on the dimension you're creating the member is this line mainly:
Dim newmemberProperties As ScenarioVMProperties = objMemberInfo.GetScenarioProperties()
Then, to accomplish Step 2, as I mentioned above, here's another sample code to create the relationship:
Dim NewMemberInfo As MemberInfo = BRApi.Finance.Metadata.GetMember(si, DimTypeIdName, ChildName)
Dim NewMemberId As Integer = NewMemberInfo.Member.MemberId
Dim relPk As New RelationshipPk(DimTypeIdName, ParentMemberId, NewMemberId)
Dim rel As New Relationship(relPk, DimID, RelationshipMovementType.InsertAsLastSibling, 1)
Dim relInfo As New RelationshipInfo(rel, Nothing)
Dim relPostionOpt As New RelationshipPositionOptions()
' Move the member to the parent
BRApi.Finance.MemberAdmin.SaveRelationshipInfo(si, relInfo, relPostionOpt)
Hope this helps!