Skip to main content
Expert
August 1, 2022
Solved

Scenario name from ScenarioKey

  • August 1, 2022
  • 2 replies
  • 0 views

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

Best answer by AndreaF
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

AndreaFAuthorAnswer
Expert
August 1, 2022
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!
Newcomer
August 1, 2022

Or a better option is to use ScenarioDimHelper.GetNameFromID(si,  si.WorkflowClusterPk.ScenarioKey). It works similarly to the TimeDimHelper function.