The OneStream Community is temporarily frozen until June 29th due to the ongoing maintenance. Please read the blog post here to learn more.

Forum Discussion

OSAdmin's avatar
OSAdmin
Icon for OneStream Employee rankOneStream Employee
6 years ago

In a confirmation rule, I need to get the Account dimension that is attached to the cube based on the WF that is in the POV

Originally posted by Rob Dessureault

5/15/2019

In a confirmation rule, I need to get the Account dimension that is attached to the cube based on the WF that is in the POV

1 Reply

  • OSAdmin's avatar
    OSAdmin
    Icon for OneStream Employee rankOneStream Employee
    Originally posted by Nick Bolinger

    Rob, give this a try. I tested writing to the error log and it gave me the cube name and account dim name that I expected.

    'Get cube name from WF
    Dim wfUnitInfo As WorkflowUnitInfo = api.Workflow.GetWorkflowUnitInfo()
    Dim wfName As String = wfUnitInfo.ProfileName
    Dim wfprofileInfo As WorkflowProfileInfo = BRApi.Workflow.Metadata.GetProfile(si, wfName)
    Dim cubeName As String = wfProfileInfo.CubeName

    'Cube Account Dim can vary by scenario type
    'Set scenario based on Workflow
    Dim scenarioType As ScenarioType = api.Workflow.GetScenarioType()

    'Set dim type to Account
    'Get cube info to query the account dim ID
    Dim dimType As DimType = DimType.Account
    Dim cubeToQuery As CubeInfo = api.Cubes.GetCubeInfo(cubeName)
    Dim dimID As Integer = cubeToQuery.Cube.CubeDims.GetDimId(dimType.Id, scenarioType.Id)

    'Set dimPK
    Dim pk As New DimPk(dimType.Id, dimId)

    'Get account dim and Dim Name
    Dim AcctDim As [Dim] = api.Dimensions.GetDim(pk)
    Dim dimName As String = AcctDim.Name

    'For testing
    'brapi.ErrorLog.LogMessage(si, ""Cube = "" & cubeName & "" dimName = "" & dimName)