Forum Discussion

Manju's avatar
Manju
New Contributor II
2 days ago

Time always returns 0001-01-01 in BR when using XFBR in Cube View

Hi,

I am calling a Business Rule (BR) in a Cube View using XFBR as follows:

XFBR( BR_ParamHelper, FunctionName, WFname = |WFText2|, SelectEntity = |!WF_AssignedEntity!|, Time = |!Time!| )

Inside the BR, I parse the year from Time to control flows:

Dim wfYear As Integer = 0
If args.NameValuePairs.ContainsKey("Time") Then
    Dim POVTime As String = args.NameValuePairs("Time")
    wfYear = CInt(Left(POVTime, 4))
End If

If wfYear >= 2026 Then
    ' Remove  flows for specified entities
Else
    ' Keep historical flows
End If

Problem:
When I log POVTime or wfYear, it always shows 0001-01-01, so my logic for removing ENT/EXIT based on the year never triggers.

What I have tried:

Verified the Cube View POV is correctly set.
Passed Time = |!Time!| from the Cube View XFBR call.
Logged args.NameValuePairs("Time") — still returns 0001-01-01.

Question:

Is Time = |!Time!| the correct way to pass the POV period to a BR?
Is there a difference between |!Time!| and |!POV!| or T#POV in Cube Views for BRs?
How can I get the actual workflow year in the BR so I can apply logic like wfYear >= 2026?

Any guidance or examples on how to correctly get the year of the workflow/POV in a BR would be greatly appreciated.

5 Replies

  • Hi Manju, most easy is to use substitution variables to insert these kind of info into your BR. 

    Use the glasses on top and select Substitution Variables on the left bottom to see what is available. e.g. |POVTime|.

    in this case you don't use ! but only the pipes.

  • JackLacava's avatar
    JackLacava
    Icon for OneStream Employee rankOneStream Employee

    It should also be noted that WF* variables are reliably populated only when items are used into an actual Workflow step, for example in a custom Dashboard used in a Workspace step. Executing a cube view on its own will likely not have those variables set.

  • sameburn's avatar
    sameburn
    Icon for OneStream Employee rankOneStream Employee

    I agree with MarcR​ 

    You can also use |POVYear| to avoid any manipulation if you only want to retrieve the Year from POV e.g.

     

  • Manju's avatar
    Manju
    New Contributor II

    i tried both |Time| and |POVTime| it didn't work

    including XFBR function 

    XFBR(BR_Name, FunctionName, SelectEntity = |Entity|, Time = |Time| ) 
    Time = |POVTime| it didn't work.

    BR,

    Public Function BR_Name(  ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As DashboardStringFunctionArgs) As String

    Try

    Dim Entity As String = ""

    If args.NameValuePairs.ContainsKey("SelectEntity") Then

    Entity = args.NameValuePairs("SelectEntity")

    Else

    Return "" ' No entity → return nothing

    End If

    Dim POVTime As String = ""

    Dim povYear As Integer = 0

    If args.NameValuePairs.ContainsKey("Time") Then

    POVTime = args.NameValuePairs("Time") ' e.g., "2025M12"

    If POVTime <> "" Then

    Try

    povYear = CInt(Left(POVTime, 4))

    Catch

    povYear = 0

    End Try

    End If

    End If

    Dim ENTRemoveEntities_2026 As String() = {"Entity1","Entity2","Entity3"}

    Dim EXITRemoveEntities_2026 As String() = {"Entity4","Entity5"}

    Dim HistoricalENT As String() = {"Entity1","Entity2","Entity3"}

    Dim HistoricalEXIT As String() = {"Entity4","Entity5""}

    If povYear >= 2026 Then

    If Entity = "Entity3" Then

    Return "ENT" 

    ElseIf ENTRemoveEntities_2026.Contains(Entity) Then

    Return "" ' ENT removed

    End If

     

    ' EXIT rules

    If EXITRemoveEntities_2026.Contains(Entity) Then

    Return "" ' EXIT removed

    End If

     

    ' Default for 2026+ other entities

    Return "ENT"

    End If

     

    If HistoricalENT.Contains(Entity) Then

    Return "ENT"

    End If

    If HistoricalEXIT.Contains(Entity) Then

    Return "EXIT"

    End If

    Return "ENT"

    Catch ex As Exception

    Return "ENT"

    End Try

    End Function

     

     

    • sameburn's avatar
      sameburn
      Icon for OneStream Employee rankOneStream Employee

      Do you have Time selected in your POV? If not, |POVTime| will not work

      Also I don't believe |Time| is valid as a substitution variable

      Have you tried logging the Time variable that gets passed into your code e.g before adding your logic; just to demystify what variable values are being passed into your logic?

      This works as expected for me