We use a Dashboard Data Set BR to extract base entities and immediate parent. Check out if this is of any help.
Namespace OneStream.BusinessRule.DashboardDataSet.Entity_Parent_List
Public Class MainClass
Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As DashboardDataSetArgs) As Object
Try
Select Case args.FunctionType
Case Is = DashboardDataSetFunctionType.GetDataSetNames
Dim names As New List(Of String)()
names.Add("CustomData")
Return names
Case Is = DashboardDataSetFunctionType.GetDataSet
If args.DataSetName.XFEqualsIgnoreCase("CustomData") Then
'Build a lookup of members and descriptions using a member script
Using dbConnFW As DbConnInfo = BRAPi.Database.CreateFrameworkDbConnInfo(si)
Using dbConnApp As DbConnInfo = BRAPi.Database.CreateApplicationDbConnInfo(si)
'Get the Members using member script
Dim ms As String = "E#[Your Entity Top].Base" 'replace with your top entity for base list
Dim objDim As OneStream.Shared.Wcf.Dim = DimsWcf.GetDimUsingName(dbConnFW, dbConnApp, "Entities")
Dim members As List(Of MemberInfo) = MetadataWcf.GetMembersUsingFilter(dbConnFW, dbConnApp, Nothing, si.WorkflowClusterPk, si.PovDataCellPk, objDim.DimPk, ms, 0, Nothing, Nothing, True, False, True)
'Build a dictionary of members and descriptions
Dim dt As New DataTable()
dt.Columns.Add("Entity", GetType(String))
dt.Columns.Add("Parent", GetType(String))
Dim ent As String = String.Empty
Dim parent As String = String.Empty
For Each memInfo As MemberInfo In members
ent = memInfo.Member.Name & "-" & memInfo.Member.Description
Dim objDimPk As DimPk = BRApi.Finance.Dim.GetDimPk(si, "Entities")
Dim parentList As List(Of Member) = BRApi.Finance.Members.GetParents(si, objDimPk, memInfo.Member.MemberId, False)
parent = parentList.Item(0).Name
dt.Rows.Add(ent, parent)
Next
Return dt
End Using
End Using
End If
End Select
Return Nothing
Catch ex As Exception
Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
End Try
End Function
End Class
End Namespace