Multiple source columns to a single target dim based on hierarchical relationships - Mapping
Hello Experts,
Here's the scenario:
We have a flat file coming from the client's source with multiple source columns. We need "Region", "Cost Center", and "Business Unit" in this case from the file to build the solution.
We have developed an unique UD2 dimension in the app which will act as a target dimension for these 3 source columns(Region, CC, & BU).
Creating a one to one mapping for all the possible combinations for (Region, CC, & BU) would be tedious.
Currently, we are thinking of writing a Complex Expression in the UD2(target) transformational rule, that would first lookup the parent values of all the base members from the 3 columns combination and return the respective value of it's target.
Something like the below snippet.
Any sample code or alternative solution would be really helpful. Thanks!
Dim U1 As String = args.GetTarget("U1#")
Dim U3 As String = args.GetTarget("U3#")
Dim U4 As String = args.GetTarget("U4#")
Dim objDimPk As DimPk = BRApi.Finance.Dim.GetDimPk(si, CostCenter)
Dim sValue As Integer = BRApi.Finance.Members.GetMemberId(si, dimTypeId, memberName)
Dim eValue As Integer = BRApi.Finance.Members.GetMemberId(si, dimTypeId, memberName)
Dim bValue As Boolean = BRApi.Finance.Members.IsDescendant(si, objDimPk, sValue, eValue, dimDisplayOptions)
If (U1 = "ABC" And IsDescendant(U4, "CostCenter", "XYZ")) Then
Return "TARGETUD2"
Else
Return ""
End If