The OneStream Community is temporarily frozen until June 29th due to the ongoing maintenance. Please read the blog post here to learn more.
Forum Discussion
vmanojrc30
3 years agoContributor
Using Memberlists in Finance BR
Hi I have created a member list on Account dimension members to pull accounts with Account type "Balance Recurring". Now I need to use this member list in Finance BR - Calculate Function Type to l...
- 3 years ago
It would be executed for each Entity unless you store it as a global:
https://community.onestreamsoftware.com/t5/Rules/What-is-the-globals-object-good-for/m-p/1839
- 3 years ago
The data buffer function looks like this:
api.Data.GetDataBufferUsingFormula("RemoveNoData(FilterMembers(A#All, A#Root.Base.Where(AccountType = 'BalanceRecurring')))")
The first parameter of the FilterMembers function creates the query and the following once the restrictions. The first pov script doesn't need to be of the same dimensionality than the others.
This would work as well:
api.Data.GetDataBufferUsingFormula("RemoveNoData(FilterMembers(U1#None, A#Root.Base.Where(AccountType = 'BalanceRecurring')))")
- 3 years ago
You don‘t need to run it in the global entity. You just need to make sure, that it run only once.
This is how it works:
SyncLock Globals.LockObjectForInitialization Dim BR_AccountList As List(Of String) = Globals.GetObject("BR_AccountList_Global") Dim BR_AccountMember_Name As String If BR_AccountList is nothing Then Dim BR_AccountList_Info As List(Of MemberInfo) = api.Members.GetMembersUsingFilter(api.Dimensions.GetDim("RevPlan_Accounts").DimPk, "A#Root.Base.Where(AccountType = 'BalanceRecurring')", Nothing) If (Not BR_AccountList_Info Is Nothing ) Then BR_AccountList = New List(Of String) For Each BR_AccountMember As MemberInfo In BR_AccountList_Info BR_AccountMember_Name = BR_AccountMember.Member.Name BR_AccountList.Add(BR_AccountMember_Name) Next End If Globals.SetObject("BR_AccountList_Global" , BR_AccountList) End If End SyncLock If POVENTITY = "S0001" Then For Each GlobalMember As String In BR_AccountList api.LogMessage("Member :" & GlobalMember) Next End IfI‘m not at my desk to test the code, it might has some spelling issue, but it should work.
- 3 years ago
Hi
I hope you will have success with the globals, they are mighty.
- To answer your questions, yes, the globals survive multiple periods, this can be very helpful, if the information doesn't change over time.
- If it changes, just add the time member (or any other dimension) to the globals name: VAR_dtElasticity_Rental = Globals.GetObject("GLOBAL_dtElasticity_Rental_Table" & api.pov.time.name)
- Yes, you can further query the datatable object. You can do so many things, I can't explain everything here, but Datatable is a Microsoft object (https://learn.microsoft.com/en-us/dotnet/api/system.data.datatable?view=net-7.0), and the internet is full of tutorials and helps. You can use LINQ to access the information from a datatable's rows. In fact, it is recommended to reduce queries to the sql database as much as possible; globals are an effective way to do so.
I hope this helps and cheers
Christian
vmanojrc30
3 years agoContributor
I built the below code to get the list of Balance Recurring Accounts and Store it to the Globals.I am running this rule for a single entity and assigning the Globals.SetObject within the scope of "Global" Entity.
Now when I run the Globals.GetObject on other entities it doesn't pull the list of members. It didn't work when I moved the Globals.SetObject outside of the scope of "Global" Entity as well.
It is retrieving the members only when it is run for "Global" Entity.
Any pointers would be appreciated if I am missing something.
'**********************************************************************************************************************
Dim BR_AccountList As List(Of String)
Dim BR_AccountMember_Name As String
If POVENTITY = "Global" Then
Dim BR_AccountList_Info As List(Of MemberInfo) = api.Members.GetMembersUsingFilter(api.Dimensions.GetDim("RevPlan_Accounts").DimPk, "A#Root.Base.Where(AccountType = 'BalanceRecurring')", Nothing)
If (Not BR_AccountList_Info Is Nothing ) Then
BR_AccountList = New List(Of String)
For Each BR_AccountMember As MemberInfo In BR_AccountList_Info
BR_AccountMember_Name = BR_AccountMember.Member.Name
BR_AccountList.Add(BR_AccountMember_Name)
Next
End If
Globals.SetObject("BR_AccountList_Global" , BR_AccountList)
End If
Dim BR_AccountList_Global As List(Of String) = Globals.GetObject("BR_AccountList_Global")
If POVENTITY = "S0001" Then
For Each GlobalMember As String In BR_AccountList_Global
api.LogMessage("Member :" & GlobalMember)
Next
End If
Related Content
- 8 months ago
- 1 year ago
- 1 year ago