Using Memberlists in Finance BR
- 2 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
- 2 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')))")
- 2 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 If
I‘m not at my desk to test the code, it might has some spelling issue, but it should work.
- 2 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 (learn.microsoft.com), 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