Forum Discussion

Keyser_Soze's avatar
Keyser_Soze
Contributor
11 months ago

Export Data (Including Dynamic Calcs) using a DataBuffer

I am trying to export Data including dynamically calculated accounts using a DataBuffer (Not just base members but all intermediate levels).
I can do this by looping over Accounts+U1+U2 combined with GetDataCell()... but it is unbearably long and inefficient

I am wondering if we can use a data buffer this way ? If not what would the best method be ? 

Dim MFEntity As String = "E#TopEntity.TreeDescendants.Where(Text1 Contains 'myValue')"
Dim lstofEntities As List(Of MemberInfo) = BRApi.Finance.Metadata.GetMembersUsingFilter(si, "Entity_Dimension", MFEntity, True)

Dim MFAccounts As String = "A#Root.Base.Where(AccountType = 'DynamicCalc')" 
Dim lstofAccounts As List(Of MemberInfo) = BRApi.Finance.Metadata.GetMembersUsingFilter(si, "Account_Dimension", MFAccounts, True)
Dim lstofAccountsStr As String = String.Join(", ", lstofAccounts.Select(Function(x) "A#" & x.Member.Name).ToList())

For Each myEntity In lstofEntities
      Dim mfDataBuffer As String = "FilterMembers(E#" & myEntity.Member.Name & ":T#" & myTime & ":S#" & myScenario & ":C#Local , (V#YTD, V#Periodic), (" & lstofAccountsStr & ") )"

      Dim tpDataBuffer As DataBuffer = api.Data.GetDataBufferUsingFormula(mfDataBuffer,, False)

Next myEntity

I get an error when generating a databuffer saying the filter for the Accounts is expecting a right parenthesis after first member. Is the syntax 'FilterMembers(.... , (A#Acc1, A#Acc2, A#Acc3)) not accepted ?

 

  • There is no need for parentheses inside FilterMembers, just list all the filters you want to apply. I may be wrong, but I think you should be able to have multiple filters for the same dimension and they will act as OR, in the same way as in Calculate filters.

    As for exporting dynamic data, I would recommed using FdxExecuteCubeView instead.

  • JackLacava's avatar
    JackLacava
    Honored Contributor

    There is no need for parentheses inside FilterMembers, just list all the filters you want to apply. I may be wrong, but I think you should be able to have multiple filters for the same dimension and they will act as OR, in the same way as in Calculate filters.

    As for exporting dynamic data, I would recommed using FdxExecuteCubeView instead.

    • Keyser_Soze's avatar
      Keyser_Soze
      Contributor

      The CubeView method is awesome, thanks a bunch !
      Would you recommend separating data (Non dynamic/Dynamic) using FdxDataUnit & FdxCubeView then joining tables later on ? or we can insert everything in the CView ? (time-wise)

      • Steven's avatar
        Steven
        Contributor II

        The cube view will pull your ALL your data.

        Why do you want to split it out and then try to merge it back together?  That seems like you would create more potential for data issues/risk.