Forum Discussion

ShivaPrasad's avatar
ShivaPrasad
New Contributor II
10 days ago
Solved

How to pull Workflow Start time to Workflow end time in Report(Cube View)

Hi Team,

Generally, In Scenario settings will updated the "Workflow Start Time & Workflow End Time". so here we want to get these workflow time rang in Cube View. (Eg: Work Flow Start Time: 2025M6 & Work Flow End Time: 2026M5). Based on scenario selection in  the report, we should get the (12 periods) time range in report.  Please help us to get the solution.

Thank you,

Shiva Prasad

  • Hi ShivaPrasad​ 

    There are api's to retrieve those values for you.  If you search for "time" in the snippet library, you will find them under Scenario e.g. see below

     

     

     

     

     

     

    Here is an example to return the time range for a Scenario with Workflow Tracking Frequency -> Range

    Sample Code:

    	' Declare scenario name
    	Dim scenarioName As String = "PriorForecast"
    	
    	' Retrieve scenario ID
    	Dim scenarioId As Integer = ScenarioDimHelper.GetIdFromName(si, scenarioName)
    	
    	' Retrieve Workflow Start Time from Scenario
    	Dim startTimeID As Integer = BRApi.Finance.Scenario.GetWorkflowStartTime(si, scenarioId)
    	' Retrieve Workflow End Time from Scenario
    	Dim endTimeID As Integer = BRApi.Finance.Scenario.GetWorkflowEndTime(si, scenarioId)
    	
    	' Derive list of times within range and return as List(Of String)
    	Dim objList As List(Of String) = TimeDimHelper.GetIdsInRange(startTimeID, endTimeID). _
    									 Select(Function(time) TimeDimHelper.GetNameFromId(time)).ToList()
    
    	' Log result as comma separated values
    	BRApi.ErrorLog.LogMessage(si, "Range Scenario Time Range", String.Join(",", objList))

    Log Output:

    Thanks

    Sam

2 Replies

  • sameburn's avatar
    sameburn
    Contributor III

    Hi ShivaPrasad​ 

    There are api's to retrieve those values for you.  If you search for "time" in the snippet library, you will find them under Scenario e.g. see below

     

     

     

     

     

     

    Here is an example to return the time range for a Scenario with Workflow Tracking Frequency -> Range

    Sample Code:

    	' Declare scenario name
    	Dim scenarioName As String = "PriorForecast"
    	
    	' Retrieve scenario ID
    	Dim scenarioId As Integer = ScenarioDimHelper.GetIdFromName(si, scenarioName)
    	
    	' Retrieve Workflow Start Time from Scenario
    	Dim startTimeID As Integer = BRApi.Finance.Scenario.GetWorkflowStartTime(si, scenarioId)
    	' Retrieve Workflow End Time from Scenario
    	Dim endTimeID As Integer = BRApi.Finance.Scenario.GetWorkflowEndTime(si, scenarioId)
    	
    	' Derive list of times within range and return as List(Of String)
    	Dim objList As List(Of String) = TimeDimHelper.GetIdsInRange(startTimeID, endTimeID). _
    									 Select(Function(time) TimeDimHelper.GetNameFromId(time)).ToList()
    
    	' Log result as comma separated values
    	BRApi.ErrorLog.LogMessage(si, "Range Scenario Time Range", String.Join(",", objList))

    Log Output:

    Thanks

    Sam

  • pranav46's avatar
    pranav46
    Contributor II

    Hey, I have built XFBR to pull 12 months range and pulled in the column in the CubeView, DM etc.
    You could put above formula mentioned by Sam in the XFBR and use it cubeview.