Forum Discussion

EmilieDurand's avatar
EmilieDurand
New Contributor II
3 years ago

Scenario Business Rule

Hi all! I need your help with a finance BR. I have a Budget scenario with different versions children members (ex: Budget, Budget_v1, Budget_V2, etc.) Right now my script goes like this: 

Dim isBudget As Boolean = api.Pov.Scenario.Name.XFContainsIgnoreCase("Budget")

If isBudget  Then

I am trying to find a script where I don't use "Contains", as if new scenarios are created in the future, the word "Budget" will always need to be apart of the member name, which is not ideal. Any suggestions how I can call the children members of Budget?

Thanks

  • EricOsmanski's avatar
    EricOsmanski
    Valued Contributor

    You will want to use something such as : Dim bValue As Boolean = api.Members.IsChild(dimPk, parentMemberId, childMemberId, dimDisplayOptions)

  • Henning's avatar
    Henning
    Valued Contributor II

    One might also use scenariotype if one wants to check for all Budget scenarios of that same type in case they are not all grouped under a parent.

    Dim objScenarioType As ScenarioType = api.Scenario.GetScenarioType(scenarioId)

    • Cosimo's avatar
      Cosimo
      Contributor II

      What Henning is saying makes sense. You can then follow up with the IF-THEN condition:

      If objScenarioType = ScenarioType.Budget Then

            do stuff...

      end if

       

  • Krishna's avatar
    Krishna
    Valued Contributor

    You can also use

    If api.Pov.Scenario.Name = "Budget" Then