Forum Discussion

raoulheinen's avatar
raoulheinen
New Contributor II
2 years ago

Weekly scenario - Use scenario start/end period settings

Hi community,

 

For one of our clients we are looking for the following.

 

- We create 52 weekly scenario with each their own start and end period setting in the workflow start time and workflow end time. For example we have the scenario CFF_2022W01 which has a workflow start time as 2022W1 and a workflow end time as 2022 W39. For example the scenario CFF_2022W02 which has a workflow start time as 2022W2 and a workflow end time as 2022 W39 etc. 

 

How can we get a list of members of the range within the start and end time in the scenario. So for example based on the CFF_2022W01 scenario it should return in the list 2022W1, 2022W2 up until 2022W39. 

For CFF_2022W02 it should return in a list 2022W2, 2022W3 up until 2022W39.

There is also the example when the periods run across years. So for example the scenario CFF_2022W27 has a workflow start time of 2022W27 and end time of 2023W13. The list should then return 2022W27, 2022W28 up until 2022W52 plus also 2023W1 up until 2023W13.

 

This is what I used so far but is not working correctly for weeks.

 

---

Dim instance As New BRApiFinanceScenario()
Dim ScenarioStartPeriod As Integer = instance.GetWorkflowStartTime(si, ScenarioId)
Dim ScenarioEndPeriod As Integer = instance.GetWorkflowEndTime(si, ScenarioId)
Dim noOfNoInput As Integer = instance.GetWorkflowNumNoInputTimePeriods(si, ScenarioId)

Dim ScenarioPeriods As List(Of Integer) = TimeDimHelper.GetIdsInRange(ScenarioStartPeriod, ScenarioEndPeriod)
'Removes all periods up until the input range
ScenarioPeriods.RemoveRange(0, noOfNoInput)

 

-----

 

Has anyone come across using these settings and what syntax should be used.

  • MikeG's avatar
    MikeG
    Contributor III

    Hi raoulheinen , remove the .Base from my prior comment.  So it looks like this:

    Then WFPOV is set to use the Range Scenario:

     

    Your Form will pick up the Start and End Periods defined on the Scenario properties.

    Hope this helps.

    • WernerN's avatar
      WernerN
      Contributor

      MikeG to the rescue, as so many times!
      Thank you so much for this post, Mike. It is an old post and still hugely valuable.  Had no idea we had this function.

  • MikeG's avatar
    MikeG
    Contributor III

    Try T#Root.WFTimePeriods.Base, if Time is your Columns, drop it there in the Member Filter builder.  It's not a well documented shortcut for Range based Scenarios.  

     

    Hope this helps,