Forum Discussion

AndreaF's avatar
AndreaF
Contributor III
3 years ago
Solved

Scenario name from ScenarioKey

Hi,

 

I am working with WorkflowClusterPk objects and I know I can get the ScenarioKey, which is an integer, like this:

Dim scenarioKey As Integer = si.WorkflowClusterPk.ScenarioKey

 

How do I get the scenario name (as a string) from the ScenarioKey? Is it possible?

Alternatively, which function could I use to get the current workflow scenario name?

 

Thank you

  • I'll answer my own question. A command like this can be used:
    Dim sScenarioName As String = BRApi.Finance.Members.GetMemberName(si, "2", scenarioKey)
     
    I don't know why, but I had the idea the ScenarioKey was a different number than the MemberId (used in the GetMemberName function), but they are in fact the same thing!

2 Replies

  • AndreaF's avatar
    AndreaF
    Contributor III
    I'll answer my own question. A command like this can be used:
    Dim sScenarioName As String = BRApi.Finance.Members.GetMemberName(si, "2", scenarioKey)
     
    I don't know why, but I had the idea the ScenarioKey was a different number than the MemberId (used in the GetMemberName function), but they are in fact the same thing!
  • Or a better option is to use ScenarioDimHelper.GetNameFromID(si,  si.WorkflowClusterPk.ScenarioKey). It works similarly to the TimeDimHelper function.