Forum Discussion

rjgoss's avatar
rjgoss
New Contributor III
3 years ago

GetDataCell in Cube View or Quick View with Dynamic Members

Is there any way to do a GetDataCell in a Cube View or Quick View where the members are dynamic/based on some criteria?  The formula below doesn't work, but hopefully give you an idea of what I wish ...
  • ChrisLoran's avatar
    3 years ago

    You could do something like this in your cubeView row definition:

    GetDataCell(XFBR(CubeViewLists,GetSumMemberFormula,DimName=[|WFEntityDim|],MemberFilter=[E#Clubs.Base.Where(Text2 = Mfg)])):Name("Total Mfg Entities")

     

    And then in your Business Rules XFBR string, have a business rule like this:
    ____________________________________

    Namespace OneStream.BusinessRule.DashboardStringFunction.CubeViewLists
    Public Class MainClass
    Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As DashboardStringFunctionArgs) As Object
    Try
    '-- Example Usage XFBR(CubeViewLists,GetSumMemberFormula,DimName=[|WFEntityDim|],MemberFilter=[])
    If args.FunctionName.XFEqualsIgnoreCase("GetSumMemberFormula") Then
    Dim strMbrFilter As String = args.NameValuePairs("MemberFilter")
    Dim strDimName As String = args.NameValuePairs("DimName")

    Dim dpk As DimPk = BRApi.Finance.Dim.GetDimPk(si, strDimName)
    If dpk Is Nothing Then
    Throw New XFException(si, "Error, specified dimension does not exist", strDimName)
    Else
    Dim lstMI As List(Of MemberInfo) = brapi.Finance.Members.GetMembersUsingFilter(si, dpk, strMbrFilter, True )

    Dim strList As String = String.Join(" + ", (From l In lstMI Select "E#[" & l.Member.Name & "]").ToArray())
    Return strList
    End If

    End If

    Return Nothing
    Catch ex As Exception
    Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
    End Try
    End Function
    End Class
    End Namespace