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
Hi Christian
Thanks very much. This is very helpful. I have a few follow-up questions on how the Global Variables works and I hope you can help clarify.
1.So If I run a consolidation on a Parent Entity for 12 Periods, will the Global Variable be locked for ALL 12 periods throughout the Consolidation Process OR would it be re initialized every Period?I understand it is locked for ALL Entities within a period but want to know if its locked for the entire periods that we run a consolidation process.
2. If it is locked for entire periods of a Consolidation, is there a way to re assign the variables every Period? I have some Global Factors that's same across ALL entities but different across periods.
3. I am storing a SQL query output from an External DB table in the Global Variable.Ex:
VAR_dtElasticity_Rental = Globals.GetObject("GLOBAL_dtElasticity_Rental_Table")
Within the calcs, I have to further query this table against each entities calculated value. Now is the only option to get the records are to pull by rows and columns like VAR_dtElasticity_Rental.Rows.Item(0).Item("ColumnName") OR Is it possible to use select statments with the Global variables as table name? Like Select * from VAR_dtElasticity_Rental
ChristianW
OneStream Employee
3 years agoHi
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
- vmanojrc303 years agoContributor
Thanks for providing some insights, Christian! I appreciate it.
Related Content
- 8 months ago
- 1 year ago
- 1 year ago