Forum Discussion
Krishna
9 months agoValued Contributor
Dim newMember As MemberInfo = Nothing
'Get the dimension parent member which will give us the dimension / relationship info need to create the member
Dim parentMem As MemberInfo = BRApi.Finance.Metadata.GetMember(si, dimTypeId, parentName)
If Not parentMem Is Nothing Then
'Control Switches
Dim saveMember As Boolean = True
Dim saveProps As Boolean = True
Dim saveDescs As Boolean = False
Dim saveRelationship As Boolean = True
Dim isNewMember As Boolean = True
'Other parameters that we are not using but must be supplied
Dim varProps As VaryingMemberProperties = Nothing
Dim altDescList As List(Of MemberDescription) = Nothing
'altDescList.Add
'Member
'Dim dimensionId As Integer
Dim dimensionPk As New DimPk(BRApi.Finance.Dim.GetDim(si,dimensionName).DimPk)'(dimTypeId, parentMem.Member.DimId)
Dim newMemPk As New MemberPk(dimTypeId, DimConstants.Unknown)
Dim newMem As New Member(newMemPk, memberName, memberDesc, dimensionPk.DimId)
'Relationship
Dim relPk As New RelationshipPk(dimTypeId, parentMem.Member.MemberId, DimConstants.Unknown)
Dim rel As New Relationship(relPk, newMem.DimId, RelationshipMovementType.InsertAsLastSibling, 1)
Dim relInfo As New RelationshipInfo(rel, Nothing)
Dim relPostionOpt As New RelationshipPositionOptions()
'Create the member and relationship
Dim metaAdmin As New MetadataAdmin
Dim newRelPK As RelationshipPk
newRelPK = metaAdmin.SaveMemberAndRelationshipInfo(si, dimensionPk, saveMember, newMem, saveProps, varProps, saveDescs, _
altDescList, saveRelationship, relInfo, relPostionOpt, isNewMember)
'Get the newly added member and return it
If Not newRelPK Is Nothing Then
newMember = BRApi.Finance.Metadata.GetMember(si, dimTypeId, newRelPK.ChildId)
End If
End If
Return newMember
Related Content
- 4 months ago
- 12 months ago