Forum Discussion

lrossi1's avatar
lrossi1
New Contributor
14 hours ago

Need help passing business rule into scenario member filter of Cube View.

I have a cube view with 12 columns (one for each  month). It is used in a quarterly activity, and the columns need to reflect the appropriate forecast scenario depending on which workflow was opened. (e.g. in June 2026, the cube view would have the 6+6 Forecast for Jul thru Dec). I've created the below BR to determine each forecast should be used, but now I'm unsure what I need to enter into the cube view scenario member filter for the columns to use this BR:

Public Function OCF_FcstScenarioSelect(ByVal si As SessionInfo, ByVal api As Object, ByVal args As FinanceRulesArgs) As Object
    Try
        ' Workflow POV time (from workflow context)
        Dim wfTime As String = api.Workflow.Time.Name
        Dim wfPos As Integer = wfTime.IndexOf("M"c)
        Dim wfYear As Integer = CInt(wfTime.Substring(0, wfPos))
        Dim wfMonth As Integer = CInt(wfTime.Substring(wfPos + 1))

        ' Column POV time (from cube view)
        Dim colTime As String = api.Pov.Time.Name
        Dim colPos As Integer = colTime.IndexOf("M"c)
        Dim colYear As Integer = CInt(colTime.Substring(0, colPos))
        Dim colMonth As Integer = CInt(colTime.Substring(colPos + 1))

        Dim scen As String

        ' Determine scenario per column
        If (colYear < wfYear) OrElse (colYear = wfYear AndAlso colMonth <= wfMonth) Then
            scen = "ActBud"
        Else
            Select Case wfMonth
                Case 3 : scen = "Forecast_3_9"
                Case 6 : scen = "Forecast_6_6"
                Case 9 : scen = "Forecast_9_3"
                Case Else : scen = "ActBud"
            End Select
        End If

        Return scen

    Catch ex As Exception
        Throw ErrorHandler.LogWrite(si, New Exception("Error in OCF_FcstScenarioSelect: " & ex.Message))
    End Try
End Function

I would appreciate any help, as I'm new to using BR's for this purpose, and I have been unsuccessful in finding a solution to my specific issue via search engines.

Thanks in advance!

1 Reply

  • lrossi1's avatar
    lrossi1
    New Contributor

    It seems that my BR is probably the issue, but I'm not sure how to fix it