Forum Discussion

Philip's avatar
Philip
New Contributor
2 years ago

If logic in Cubeview

Hi, I am trying to build in an if statement in a cubeview (getdatacell formula) on the cell amounts. In specific:

If cellamount of CVC(col 10) > CVC(col 11) then CVC(col1) else CVC(col1). 

The reason why I am trying to do this in a cubeview getdatacell is because the col 10 an col 11 are referencing other columns and those other columns are referencing other columns in return. A workaround would be to recreate these column references in BR or create new members with formulas doing similar. But I am trying to avoid recreating this if possible. Hope someone have ideas. 

2 Replies

  • JackLacava's avatar
    JackLacava
    Community Manager

    I think you're trying to build too much logic in the presentation layer.

    This sort of thing is typically done in a dynamic UD8 member, which you can then simply include in a CV. It keeps the business logic where it should be and it's easier to maintain than a fragile, excel-esque mountain of grid references.

  • Philip's avatar
    Philip
    New Contributor
    In addition to above, I could not find a way to do if statement directly in the getdatacell. I tried to create a XFBR. I tried to value pair to hold the cellamount value and then do the if statement in a Business rule. Below my attempt, but this errors out in the cubeview as it does not recognize the CVC syntax. 
     
    Memberfilter
    GetDataCell( XFBR( TTP_Paramhelper, Return_MIN_RPS_EBIT, RPS=CVC(RPS_EBIT) )):name(RPS_BR)
     
    Business Rule:
     
    Dim Amt As Decimal = Amt
    If args.FunctionName.XFEqualsIgnoreCase("Return_MIN_RPS_EBIT") Then
    If RPS < 0 Then
    RPS = RPS
    Else
    RPS = 0
    Return RPS
    End If
    End If
    #End Region