Forum Discussion

bilbrandon's avatar
bilbrandon
New Contributor III
3 years ago

Dimension Look-up during Transformation

We are trying to develop logic to do the following during transformation:

If the G/L account in the load is in a certain range and the UD2 member is valid, load to that intersection

     otherwise

If the G/L account in the load is in that same range but the UD2 member is invalid, map UD2 to None

 

Has anyone gotten something similar to work?

 

Thanks,
Bil

  • Give this a try with Conditional BR

    1. Create a conditional business rule and do something like this

     

    Dim account As Integer = args.GetSource("Ac#").XFConvertToInt
    Dim ud2 As String = args.GetSource("U2#")
    								
    If account >= 1000 And account <= 2000 Then
     If ud2 = "valid" Then 'check for valid U2#
      Return ud2
     Else
      Return "None"
     End If
    Else
     Return ud2
    End If

     

    2. Attach this BR to your UD2 Transformation

  • ChrisLoran's avatar
    ChrisLoran
    Valued Contributor

    Just to add to the answer already posted, if you need to lookup whether the incoming UD2 string is a valid member in the target UD2 dimension, please avoid using BRAPI functions (like BRAPI.Finance.Members.GetMember ) in BRs like this since each call to a BRAPI function creates and destroys a database connection object from the DB connection pool, which is quite inefficient.  You can make this more efficient by storing a list of valid members in memory , and caching it in BRGlobals, so it doesn't have to use BRAPI lookup functions every time.  Below example for illustration purposes...

    • bilbrandon's avatar
      bilbrandon
      New Contributor III

      Thank you - this is very helpful. Do you know if the list of members can be logged for review?

       

      Thanks
      Bil