Forum Discussion

Manjunathak's avatar
Manjunathak
New Contributor III
10 months ago

cube view formatting

I want format the Cube view cell based on cell amount

If (CellAmount > GetDataCell(CVC(Col2)) )Then
BackgroundColor = Red, TextColor = White
End if

This code is not working, Actually I am comparing actual amount with budget.

how can we do this?

 

  • GetDataCell belongs to member filters, it cannot be used in Conditional Formatting statements.

    Conditional Formatting rules can only look at the Cell contents and View Headers. So what you can do in your case is the following:

    1. create a new Column. As Member Filter, use GetDataCell to calculate the difference, e.g. GetDataCell(CVC(Col1) -CVC(Col2)):Name(Difference)
    2. On that column, apply a conditional format, e.g.
    If (CellAmount > 0) Then 
        BackgroundColor=Red, TextColor=White
    End If

    If you don't want to show the number, simply set TextColor to the same as BackgoundColor (but note the number might leak anyway, when exported as Report or Excel), or play with number formatting to round it 0/1.

  • JackLacava's avatar
    JackLacava
    Honored Contributor

    GetDataCell belongs to member filters, it cannot be used in Conditional Formatting statements.

    Conditional Formatting rules can only look at the Cell contents and View Headers. So what you can do in your case is the following:

    1. create a new Column. As Member Filter, use GetDataCell to calculate the difference, e.g. GetDataCell(CVC(Col1) -CVC(Col2)):Name(Difference)
    2. On that column, apply a conditional format, e.g.
    If (CellAmount > 0) Then 
        BackgroundColor=Red, TextColor=White
    End If

    If you don't want to show the number, simply set TextColor to the same as BackgoundColor (but note the number might leak anyway, when exported as Report or Excel), or play with number formatting to round it 0/1.