Forum Discussion

OSAdmin's avatar
OSAdmin
Valued Contributor
5 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

  • OSAdmin's avatar
    OSAdmin
    Valued Contributor
    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)