Issue Passing Parameters to Custom BR Function in Cube View Member Filter
Hi All,
I'm currently working on a Cube View where I need to use a custom Business Rule function (CalculatePer) within a member filter for ColD. The goal is to calculate values dynamically based on inputs from ColA and ColB.
To help illustrate, here’s a simplified version of the layout:
Sample Cube View:
ColA | ColB | ColC | ColD |
---|---|---|---|
100 | 150 | 250 | ? |
20 | -50 | -30 | ? |
30 | 0 | 30 | ? |
0 | 30 | 30 | ? |
Column Definitions:
- ColA → T#|CVTime|:Name(XFBR(Fin_XFBR_Consolidations, GetLastDayOfMonth, Param_SelectMonth = |CVTime|))
- ColB → T#YearPrior1(|CVYear|)M12
- ColC → GetDataCell(CVC([ColA]) - CVC([ColB]))
- ColD → Intended to call a custom function using values from ColA and ColB.
What’s Working:
When I use the BR without parameters, it works fine:
GetDataCell(BR#[Fin_GlobalHelper, CalculatePer]):Name(%)
What’s Not Working:
When I attempt to pass the values of ColA and ColB as parameters to the function, like this:
GetDataCell(BR#[Fin_GlobalHelper, CalculatePer, A=GetDataCell(CVC([ColA])), B=GetDataCell(CVC([ColB]))]):Name(ColD)
…it does not work as expected. The function does not receive the evaluated values properly, and I believe the nested GetDataCell() within the BR#[] call is causing the issue.
Attempted Alternative:
I also tried passing values directly using CVC():
GetDataCell(BR#[Fin_GlobalHelper, CalculatePer, A=CVC([ColA]), B=CVC([ColB])]):Name(ColD)
The parameter evaluation is not be happening correctly in this context and so the function is not called.
below is the custom function;
Custom Function (Business Rule Code)
Below is the code used in the Business Rule (CalculatePer) for reference:
Select Case api.FunctionType Case Is = FinanceFunctionType.DataCell
If args.DataCellArgs.FunctionName.XFEqualsIgnoreCase("CalculatePer") Then brapi.ErrorLog.LogMessage(si, "Inside CalculatePer: ")
Dim ColCP As String = args.DataCellArgs.NameValuePairs.XFGetValue("A")
Dim ColPY As String = args.DataCellArgs.NameValuePairs.XFGetValue("B")
Dim A As Decimal = api.Data.GetDataCell($"{ColCP}").CellAmount
Dim B As Decimal = api.Data.GetDataCell($"{ColPY}").CellAmount
brapi.ErrorLog.LogMessage(si, "ColCP: " & ColCP)
brapi.ErrorLog.LogMessage(si, "ColPY: " & ColPY)
brapi.ErrorLog.LogMessage(si, "A: " & A)
brapi.ErrorLog.LogMessage(si, "B: " & B)
If A > 0 Then
Return A
Else
Return B
End If
End If
End Select
Request:
Could you please advise on the correct syntax or method for passing evaluated column values (T# tokens) as parameters to a BR function in the Cube View?
Any insights or a working example would be greatly appreciated.
Best regards,
Archana