Forum Discussion

ST1's avatar
ST1
New Contributor III
5 months ago

Cube View Format

I am trying to figure out conditional formatting in a cube view to show base level members as different color.

For example, in a cube view- I have a row A#NETINC_INT.Tree,   I would like to display Net Income base members and their data in different color.

  • db_pdx's avatar
    db_pdx
    Valued Contributor

    Hi ST1: here's our version of conditional formatting for base accounts.

    This is a Dashboard XFBR String business rule named: XFBR_FormattingHelper

    If args.FunctionName.XFEqualsIgnoreCase("InAccountIsBase") Then
    '2023-12-19 | D.B. | Create a giant list to compare against for conditional formatting checks
    'Usage: In Cube View Conditional Formatting
    'Usage Example: If (RowE1MemberName In XFBR(XFBR_FormattingHelper, InAccountIsBase, TopAccount=[TopAccountOfHierarchy])) Then
    Dim topAccount As String = args.NameValuePairs.XFGetValue("TopAccount")
    Dim accountId As Integer = BRApi.Finance.Members.GetMemberId(si, DimType.Account.Id, topAccount)
    Dim baseMembers As List(Of Member) = BRApi.Finance.Members.GetBaseMembers(si, BRApi.Finance.Dim.GetDimPk(si, "AllAccounts"), accountId)
    Dim strBaseMembers As String = "'" + String.Join("','", baseMembers.Select(Function(x) x.Name)) + "'"
    Return strBaseMembers
    End If

    Note! you need to modify the piece in red to your application.

    A real-world example of usage to apply the conditional formatting (per my application/dimension/member names). This is in a Header Format of a row that contains a A#IncomeStatement.Tree expansion

    If (RowE1MemberName In XFBR(XFBR_FormattingHelper, InAccountIsBase, TopAccount=[IncomeStatement])) Then
    TextColor = Red
    End If

    Cheers,    -db

  • TheJonG's avatar
    TheJonG
    Contributor III

    Unfortunately, I do not think there is a way to do this but I'd welcome someone to prove me wrong. There is no 'HasChildren' or 'IsBase' option within Conditional Formatting. There is also no way to use an XFBR to generate the Cell Format because the |MFAccount| substitutional variable will not resolve there (only will resolve in a Member Filter). 

    This is a perhaps a good one for IdeaStream.