How to get Base Members of UD Dimension into a Variable
Could you please provide a sample script with example to Generate the base mambers of UD2 dimension into a Variable.
I'm trying to follow the below syntax, but it's not working for UD Dimensions
Dim baseMembers As List(Of Member) = api.Members.GetBaseMembers(entityDimPk, entityId, Nothing)
Appreciate your assistance.
A Member object is not a String object. You loop on the objects, and use properties out of them. Example:
Dim U3Filter As List(Of Member) = api.Members.GetBaseMembers( _ api.Pov.UD3Dim.DimPk, api.Members.GetMemberId(dimtype.UD3.Id, "TopUD3")) For Each memberObj In U3Filter ' memberObj.Name is an actual String BRApi.ErrorLog.LogMessage(si, memberObj.Name) next
(Btw, looping on lists of members should not be done in member formulas or calculation rules; ideally you want to use DataBuffers with filters and Formula Variables. I strongly recommend picking up the OneStream Finance Rules and Calculations Handbook to find out how and why.)
This is fine for Data Unit dimensions (like Entity , for example), as the opening post suggested.
Just a warning for any others coming across this thread and tempted to re-use snippets.
Only do this if you are going to loop through Data Unit dimension types (mainly Entity, Time etc).
If anyone is thinking of re-using this concept to loop through Accounts/UD members, and if you're going to work with data, and use things like GetDataCell, SetDataCell, api.Data.Calculate, then please do not do this inside your iteration loop. This usually causes huge performance problems and we have had several customer escalations due to poor performance caused by business rules that loop through Account/Flow/UD members and perform calculations in the loop.
For iterating through base Accounts/UDs, consider using a DataBuffer to loop through the stored cells, instead of looping through many dimension members which may/may not have any stored data to actually process.edit: [ I just realized Jack already warned this 2h ago. oops, so a bit of a duplicate post ]