Looping Entities In a Data Buffer

New Contributor II


I have built a Finance business rule that users a data buffer to identify base level UD1 members with data at a specific intersection and sort the results.

The user is prompted to select a parent level Entity and that is passed to the BR and used in the buffer.  Note:  The BR is called from a Cube View.

What I need to do next is take the parent level Entity that the user chooses, pull in a list of base level Entities under that parent, and then loop through my data buffer for each of those base Entities, and then add the base UD1's to my list if they meet the Text# conditions I check for. 

How do I go about calling the base level Entities member list and pass them in one at a time into my Data Buffer so it loops through them?

Thank You


New Contributor II

I got this working now.  Here is what you need to do to get it working:

Create a simple list with these 2 lines of code

Dim entityDimPk1 As DimPk = api.Dimensions.GetDim("YourEntityDimName").DimPk
Dim objEntityMemberInfos1 As List(Of MemberInfo) = api.Members.GetMembersUsingFilter(entityDimPk1,"E#" & cvEntity & ".Base",Nothing)


In the code above I'm passing in a parent Entity parameter value called cvEntity and then loading the Base members of that to the list

Then do a For Each loop around your Data Buffer call.  Don't forget the second Next after, and outside of the Data Buffer call

For Each objEntityMemberInfo As MemberInfo In objEntityMemberInfos1

Dim entityFromList As String = objEntityMemberInfo.Member.Name

Your Data Buffer Call




End If


This is great! I wonder if it's possible to check if an entity stored as a string is contained in the List of type MemberInfo to prevent looping.


Just a small word of caution.  It looks like your picking one entity, but big lists of say all base below a specific parent can really impact performance.  Consider that each buffer you are calling puts a data unit in memory.  You want to be careful you aren't calling the entire database!   The other thing to look out for is how the user is selecting the entity, anything that is waiting on a response will cause the rules to hang...