Delete Multiple Members using Extender Rule
All - The below extender rule will be able to delete multiple member from Parent Hierarchy.
1. Provide the Dimension Name & Top Parent Name in the Hierarchy - See highlighted in Red.
2. I want to make a point here the While Count > 3 because the it takes the current parent and other member ENtityDefault1 & None. Since we will not be able to delete it so it should be 3 or loop will be infinite.
3. You can use as an input Variable for Dimension and Top Parent and attach to the dashboard but this is a good starting point.
Dim dimensionPK As DimPk = BRApi.Finance.Dim.GetDimPk(si,"Dimension")
Dim nValue As Integer = BRApi.Finance.Members.GetMemberId(si, dimensionPK.DimTypeId,"TopParentName")
Dim objList1 As List(Of Member) = BRApi.Finance.Members.GetAllMembers(si,dimensionPK,nValue)
Dim objList2 As List(Of Member) = BRApi.Finance.Members.GetBaseMembers(si,dimensionPK,nValue)
Dim mbrct As Integer = objList1.Count
While mbrct > 3
For Each mbrbe As Member In objList2
If mbrbe.Name <> "None" Then
BRApi.Finance.MemberAdmin.RemoveMember(si, dimensionPK, mbrbe.MemberPk)
End If
Next
objList1 = BRApi.Finance.Members.GetAllMembers(si,dimensionPK,nValue)
objList2 = BRApi.Finance.Members.GetBaseMembers(si,dimensionPK,nValue)
mbrct = objList1.Count
End While