Skip to main content
Expert
Aug 1, 2022 1:45 PM UTC
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

AndreaFAnswer
Expert
Aug 1, 2022 2:18 PM UTC
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
Aug 1, 2022 2:18 PM UTC
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!
Member
Aug 1, 2022 10:37 PM UTC

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