We are under construction!

You may experience downtime, errors or visual oddities, but we anticipate all will be resolved by the end of the day.

Forum Discussion

OSAdmin's avatar
OSAdmin
Valued Contributor
5 years ago

Has anyone done mappings based on parents?

Originally posted by Eric Osmanski

6/15/2018

Has anyone done mappings based on parents? For example, I have a source field in the GL 100-900 that maps * to * with UD1. I want to map UD2 based on the PARENT the source field is in in OneStream. So, if the Source Field is under Project X, then map to MemberA. If Source Field is under Project Y, then map to Member B.

  • OSAdmin's avatar
    OSAdmin
    Valued Contributor
    Originally posted by Keith Berry

    As long as the UD1 member is *.*, maybe try the code below on the Data Source UD2 field (which references the UD1 column in the data file). I didn't notice a big increase in processing times with this. Just update the UD1 dimension name in the GetDimPk on line 8.

    Namespace OneStream.BusinessRule.Parser.ParentMap
    Public Class MainClass
    Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As ParserDimension, ByVal args As ParserArgs) As Object
    Try
    Dim returnstring As String = ""DefaultValue""
    Dim ud1Id As Integer = BRapi.Finance.Members.GetMemberId(si, DimType.UD1.Id, args.value)
    If ud1Id > 0 Then
    Dim parentlist As List(Of Member) = BRapi.Finance.Members.GetParents(si, BRapi.Finance.Dim.GetDimPk(si, ""YourUD1DimName""), ud1Id, True)
    If parentList IsNot Nothing AndAlso parentList.Count > 0 Then
    Dim parentUD1 As Member = parentlist.First
    returnstring = parentUD1.Name
    End If
    End If
    Return returnstring
    Catch ex As Exception
    Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
    End Try
    End Function
    End Class
    End Namespace